aggregation - ElasticSearch multifield not working -
in documents have field collaboration on aggregation queries. want full-text searchable, figured out should make multifield. field may this:
... "collaboration" : "cms" or "collaboration" : ["atlas", "cms"] or "collaboration" : "lhcb" ... following advice: elasticsearch term aggregation changed mapping to:
"collaboration": { "type": "string", "fields": { "raw": { "type": "string", "index": "not_analyzed" } } }, and run query:
post /my_index/_search { "aggs": { "collaboration": { "terms": { "field": "collaboration.raw" } } } } and nothing:
"hits": { "total": 5, "max_score": 1, "hits": [...] }, "aggregations": { "collaboration": { "doc_count_error_upper_bound": 0, "sum_other_doc_count": 0, "buckets": [] } } even when try use field searching doesn't work:
post /my_index/_search { "query": { "query_string": { "query": "cms", "fields": ["collaboration.raw"] } } } should change mapping somehow because of fact field list , string? research found arrays supposed supported out of box. suggestions might wrong here?
solved andrei stefan!
all documents needed reindexed after changing mapping, small yet painful detail.
Comments
Post a Comment