Global search, different filters per index in one query

Hi,

Due to accessibility levels in my organization, when performing a global
search across all indices within Elasticsearch, I need to apply different
filters for different indices and then combine this into one results pool.
I am wondering whether that is possible in one huge query, so that I don't
perform separate queries per index?

To clarify -- let's say I have a Post and Comment models. When fetching
results, I should only match Comments by commenter_id whereas Post by
poster_id. I have separate indices for posts and comments. Now, I'd just
perform two queries, filtering separately and then combine results. But
that's slow. Does anyone have any ideas?

Thanks!
Antek

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Wrap an indices query in a query filter....

http://www.elasticsearch.org/guide/reference/query-dsl/indices-query/

On Thursday, April 4, 2013, Antek Piechnik wrote:

Hi,

Due to accessibility levels in my organization, when performing a global
search across all indices within Elasticsearch, I need to apply different
filters for different indices and then combine this into one results pool.
I am wondering whether that is possible in one huge query, so that I don't
perform separate queries per index?

To clarify -- let's say I have a Post and Comment models. When fetching
results, I should only match Comments by commenter_id whereas Post by
poster_id. I have separate indices for posts and comments. Now, I'd just
perform two queries, filtering separately and then combine results. But
that's slow. Does anyone have any ideas?

Thanks!
Antek

--
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 <javascript:_e({},
'cvml', 'elasticsearch%2Bunsubscribe@googlegroups.com');>.
For more options, visit https://groups.google.com/groups/opt_out.

--
Thanks,
Matt Weber

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Hi,

Thanks! I actually looked at the indices query but it only gives me one
alternative. If I have more models, is multi_search my only option ?

Regards,
Antek

On Thursday, April 4, 2013 9:01:11 PM UTC+2, Matt Weber wrote:

Wrap an indices query in a query filter....

http://www.elasticsearch.org/guide/reference/query-dsl/indices-query/

On Thursday, April 4, 2013, Antek Piechnik wrote:

Hi,

Due to accessibility levels in my organization, when performing a global
search across all indices within Elasticsearch, I need to apply different
filters for different indices and then combine this into one results pool.
I am wondering whether that is possible in one huge query, so that I
don't perform separate queries per index?

To clarify -- let's say I have a Post and Comment models. When fetching
results, I should only match Comments by commenter_id whereas Post by
poster_id. I have separate indices for posts and comments. Now, I'd just
perform two queries, filtering separately and then combine results. But
that's slow. Does anyone have any ideas?

Thanks!
Antek

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
Thanks,
Matt Weber

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

You can combine several indices queries together using bool query

On Friday, April 5, 2013 5:29:33 AM UTC-4, Antek Piechnik wrote:

Hi,

Thanks! I actually looked at the indices query but it only gives me one
alternative. If I have more models, is multi_search my only option ?

Regards,
Antek

On Thursday, April 4, 2013 9:01:11 PM UTC+2, Matt Weber wrote:

Wrap an indices query in a query filter....

http://www.elasticsearch.org/guide/reference/query-dsl/indices-query/

On Thursday, April 4, 2013, Antek Piechnik wrote:

Hi,

Due to accessibility levels in my organization, when performing a global
search across all indices within Elasticsearch, I need to apply different
filters for different indices and then combine this into one results pool.
I am wondering whether that is possible in one huge query, so that I
don't perform separate queries per index?

To clarify -- let's say I have a Post and Comment models. When fetching
results, I should only match Comments by commenter_id whereas Post by
poster_id. I have separate indices for posts and comments. Now, I'd just
perform two queries, filtering separately and then combine results. But
that's slow. Does anyone have any ideas?

Thanks!
Antek

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

--
Thanks,
Matt Weber

--
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.
For more options, visit https://groups.google.com/groups/opt_out.