Elastic Search - Query multiple indices


(CC) #1

Hi! I have data stored in 3 indices that I want to query, but these indices
have different fields. If I try it like this:

curl -X GET 'http://host:9200/myindex1,myindex2,myindex3/_search?pretty' -d
'{"query":{"bool":{"must":[{"query_string":{"query":"myquery","default_operator":"AND"}},
{"range":{"due_date":{"from":"2011-11-30T19:09:06.275Z","to":"2013-07-07T02:52:37.012Z"}}}]}},
"facets":{"facet1":{"terms":{"field":"text_content", "size":100}}}}'

the results returned by ElasticSearch refer only to the first index, namely
myindex1. Another issue is that I really need to filter these results by
due_date, but only myIndex1 contains this field. The text_content field can
also vary per index, i.e that in myindex2 and myindex3 it has got a
different name.

How can I achieve my purpose using ElasticSearch? Many thanks!

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e911d3e5-1213-46bb-8ca2-04b411b04abf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2