I am facing a weird issue with Elasticsearch. My mapping specifies that a certain field is of type long. Now accidentally I was trying to index some documents which
I suspect your mapping looks similar to this:
{
"long_field": {
"type": "long"
}
}
If that's the case, you can set the coerce flag to false as it is true by default and will always try to convert strings to numbers and truncate fractions for integers.
{
"long_field": {
"type": "long",
"coerce": false
}
}
If you do this, the next time you try to index a long field as a string, ES will tell you this:
MapperParsingException[failed to parse [long_field]]; nested: IllegalArgumentException[Long value passed as String];