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.
- can use dynamic templates achieve ?
- also possible keep field names same both analyzed , not analyzed ?
- 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
Post a Comment