Is it possible to perform multiple, nested search queries (as per
BoolQueryBuilder), each nested query run against a potentially different set
of indices? Like a UNION in SQL: "return all hits where property=X in
(indexA,indexB) OR property=Y in (indexA,indexC)".
This used to be possible with Compass, but indices are specified at the
request- rather than the query level in ElasticSearch. I'd have to run each
search clause individually and UNION them up myself, which feels like a bad
idea.
Is there a better way to do this using ES?
(I should probably add that, though my indices represent different data
domains - so I can't replace them with one index and multiple types (unless
you disagree?) - they do have common properties so that they can be searched
together.)
You can't do that in elasticsearch, but, we can introduce a new "index"
element in the query DSL, that will act as match_all if not executing on the
listed indices, and use the internal query if it does.
On Wed, Oct 19, 2011 at 11:07 AM, Andrew Regan aregan@gmail.com wrote:
Is it possible to perform multiple, nested search queries (as per
BoolQueryBuilder), each nested query run against a potentially different set
of indices? Like a UNION in SQL: "return all hits where property=X in
(indexA,indexB) OR property=Y in (indexA,indexC)".
This used to be possible with Compass, but indices are specified at the
request- rather than the query level in Elasticsearch. I'd have to run each
search clause individually and UNION them up myself, which feels like a bad
idea.
Is there a better way to do this using ES?
(I should probably add that, though my indices represent different data
domains - so I can't replace them with one index and multiple types (unless
you disagree?) - they do have common properties so that they can be searched
together.)
First you can open an issue :). It should be a built in query in
elasticsearch, so it can either be the royal we, and I can implement it
(should be simple), or the "commons" we, where I can help you implement it
On Thu, Oct 20, 2011 at 6:25 PM, Andrew Regan aregan@gmail.com wrote:
Thanks, Shay. Re, the 'we', is that something I can do myself, or would it
need a new plugin, perhaps?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.