Distinct queries across multiple types in one request?

Is it possible to issue distinct queries to multiple types within the
same index? I have a few types with different mappings (some overlap)
and I need to query some of the fields of each with the same query
string, but the queries are inherently different because of the
mappings. It seems like it is only possible to execute the same query
against multiple types. If that is the case, how would you guys feel
about extending the API to support multiple distinct queries?

Here is a gist with the current queries and below that is a rough idea
of how the multiple queries could work.

Could you search at the index level like your gist, but include the "_type"
field in each query, and combine the queries with an OR?

That is probably is fine query, but it would give me all the results
mixed and scored together. I need to them to be separated based on
the type in the results.

Thanks for the reply, though!

Anyone else have thoughts on this? Is there a way to accomplish it
presently? Does it seem like a reasonable API to implement?

Thanks!

There is no way to get distinct results per type with different queries except if you execute several search requests per type.

On Wednesday, February 1, 2012 at 1:02 PM, qjh wrote:

Anyone else have thoughts on this? Is there a way to accomplish it
presently? Does it seem like a reasonable API to implement?

Thanks!

Thanks for the reply, Shay. Is that something you think is reasonable
to implement in ES as opposed to in the client? I would picture it
being similar to the bulk indexing/delete API but with queries, as
demonstrated in the gist I posted.

Effectively what you are after is "multi search" API, its definitely possible, but not high on the list (at least for now…) since you can execute several search requests, and its less acute compared to multi get / batch indexing.

On Tuesday, January 24, 2012 at 2:01 AM, qjh wrote:

Is it possible to issue distinct queries to multiple types within the
same index? I have a few types with different mappings (some overlap)
and I need to query some of the fields of each with the same query
string, but the queries are inherently different because of the
mappings. It seems like it is only possible to execute the same query
against multiple types. If that is the case, how would you guys feel
about extending the API to support multiple distinct queries?

Here is a gist with the current queries and below that is a rough idea
of how the multiple queries could work.

currently separate · GitHub

What would this kind of query look like?

On Monday, January 23, 2012 11:05:04 PM UTC-5, Mark Waddle wrote:

Could you search at the index level like your gist, but include the
"_type" field in each query, and combine the queries with an OR?