elasticsearch - Elastic Search dynamic field stored as both analyzed and not_analyzed -


i trying index json documents in elasticsearch. don't have schema of document, dynamic.

i need store fields both analyzed , not analyzed. need dynamic.

  1. can use dynamic templates achieve ?
  2. also possible keep field names same both analyzed , not analyzed ?
  3. do need special handling while searching fields ?

you accomplish using dynamic templates yes, creating dynamic mapping fields (or pattern of fields, e.g strings) this:

"dynamic_templates":[         {             "template_mystringfields":{                 "match":"somepattern",                 "mapping":{                     "type":"multi_field",                     "fields":{                         "{name}":{                             "type":"string",                             "index":"not_analyzed",                         },                         "_tokenized":{                             "type":"string",                             "index":"analyzed",                         }                     }                 }             }         }... 

then, search in both analyzed , not-analyzed, use "pattern match" if dont search in both fields @ once, or search "_all" field if ok match in field. field name same, postfix, myfield._tokenized in above example.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -