Disable date detection in cartographic image

I am indexing a document with a property obj_properties

which is the hash of the property name -> property value. elasticsearch infers that some property values ​​are dates, which leads to the next error when it encounters a subsequent value for the same property that cannot be parsed as a date.

org.elasticsearch.index.mapper.MapperParsingException: failed to parse date field <NON-DATE FIELD within obj_properties>

So, I would like to disable date detection for obj_properties

and something nested within it. Per

http://elasticsearch-users.115913.n3.nabble.com/Date-Detection-not-always-wanted-tp1638890p1639415.html

(Note, I believe the linked post contains a typo - the field should be date_formats

, not date_format

, but I've tried both ways)

I created the following mapping

mapping do
    indexes :name
    indexes :obj_properties, type: "object", date_formats: "none"
  end

      

but I keep getting the same exception. The properties in are obj_properties

not known in advance, so it is impossible to create an exhaustive type mapping. Any ideas? Does determining the date of discovery determine the correct approach?

+3


source to share


2 answers


You can turn off date detection for a specific type

one by specifying it in the display:

curl -XPUT 'http://127.0.0.1:9200/myindex/?pretty=1'  -d '
{
   "mappings" : {
      "mytype" : {
         "date_detection" : 0
      }
   }
}
'

      



or for all types in the index, specifying it by default:

curl -XPUT 'http://127.0.0.1:9200/myindex/?pretty=1'  -d '
{
   "mappings" : {
      "_default_" : {
         "date_detection" : 0
      }
   }
}
'

      

+2


source


mapping(date_detection: false) do
  indexes :name
  indexes :obj_properties, type: "object"
end

      

then curl 'http://127.0.0.1:9200/myindex/_mapping?pretty=1'

would include date_detection = false

mentioned here



Although I believe this applies to the entire index - not to a specific field

+1


source







All Articles