Multi_match boolean across fields

Hello,

I'd like to build a specific query to ES that I can't find currently, here
is what I would like to do:
The query would be a multi_match that keeps only the documents that have
all the terms in the query (the terms can be spread across several fields).

The default multi_match gives me documents that match at least one term
of the query (too much documents), and if I add "boolean": "and" it gives
me only documents that have all the terms of the query in one particular
field (too strict).

As a solution, I was thinking about using the analyzer of ES to get the
list of tokens, then do an "AND" query of multi_match queries for one
token in all the field, but it introduces a big overhead as there is two
API calls to ES.

Could you give me any pointers on how I could build such a query ?
Thanks,
Thibaut

--
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/ee1b7644-fbb5-466d-8998-f7104e25f59a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

I'd probably just aggregate all the fields you are interested in into 1
field and then match/AND on that 1 field. You probably can do a copy_to to
accomplish the aggregation to a single field:

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-core-types.html#copy-to

--
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/cf6b0267-4533-46cc-8701-d6dc4b243c75%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Thank you! I haven't tried it yet, but reading the documentation makes me
understand that it will solve my needs.

Is it possible to keep the boosting applied to the individual fields when
computing the score ?
Should I keep the original query and add the match/AND you're talking
about, as a query filter, on the field created by the copy_to ?

On Tuesday, March 4, 2014 11:52:26 PM UTC+1, Binh Ly wrote:

I'd probably just aggregate all the fields you are interested in into 1
field and then match/AND on that 1 field. You probably can do a copy_to to
accomplish the aggregation to a single field:

Elasticsearch Platform — Find real-time answers at scale | Elastic

--
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/1d2cdf59-c18b-4b02-840c-7568263bac95%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

On 5 March 2014 00:24, Thibaut thibaut.patel@gmail.com wrote:

Is it possible to keep the boosting applied to the individual fields when
computing the score ?

No. Field-level index time boosts will not be preserved with copy_to.

Coming very soon in 1.1.0 is the cross_fields type of multi_match query,
which is designed to solve exactly the problem you are dealing with. Have
a look at the docs:

--
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/CAPt3XKTmqr3Z%2Bz1CyHTQEPw2d3NT5toD_hhPngcY2OX%3DoSdM_w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

Thanks, I actually came across this part of the documentation a few hours
ago, and this sentence is exactly what I was looking for: "It first
analyzes the query string into individual terms, then looks for each term
in any of the fields, as though they were one big field.".

I can't wait to upgrade to 1.1.0 then !

On Wednesday, March 5, 2014 1:52:31 PM UTC+1, Clinton Gormley wrote:

On 5 March 2014 00:24, Thibaut <thibau...@gmail.com <javascript:>> wrote:

Is it possible to keep the boosting applied to the individual fields when
computing the score ?

No. Field-level index time boosts will not be preserved with copy_to.

Coming very soon in 1.1.0 is the cross_fields type of multi_match query,
which is designed to solve exactly the problem you are dealing with. Have
a look at the docs:
Elasticsearch Platform — Find real-time answers at scale | Elastichttp://www.google.com/url?q=http%3A%2F%2Fwww.elasticsearch.org%2Fguide%2Fen%2Felasticsearch%2Freference%2Fcurrent%2Fquery-dsl-multi-match-query.html%23multi-match-types&sa=D&sntz=1&usg=AFQjCNHAzpV5GqKrn3j5jSFEcesYigGeWw

--
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/818017bb-0eb1-4412-a68e-c7e0d6b078e9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.