Try to index fields which are missing from the Elasticsearch template defined

Viewed 663

I couldn't find any documentation regarding the following issue:

We are creating a template file for all the fields we are indexing to the Elasticsearch. The question is regarding fields which are not defined in the template:

  1. What is the default Elastic value they are index with?
  2. What are the limitations (if there are any) for indexing those fields?
  3. I was trying to index a field which it's value is a list of JSON and I got the exception: "Can't get text on a START_OBJECT at 1:311", what does it mean?
1 Answers
  1. string fields are indexed with a text field with a standard analyzer, and a subfield .keyword with a keyword datatype, with option ignore_above setted to 256. date field are tried to parse into iso 8601 format - this one yyyy-MM-dd HH:mm:ss . long is the default for numerical and double for for decimals. you could modify this default behaviour with dynamic templates. For example, if we wanted to map all integer fields as short instead of long, and all string fields as keyword, we could use the following template:

    PUT my_index { "mappings": { "dynamic_templates": [ { "integers": { "match_mapping_type": "long", "mapping": { "type": "short" } } }, { "strings": { "match_mapping_type": "string", "mapping": { "type": "keyword", "ignore_above" :256 } } } ] } }

  2. There are no limitation to index fields not defined in templates

  3. this error means that there is an error in json with es syntax, could you share this json?
Related