Is there a way to combine query_string with mlt_field?

Hi,
I can get facet counts from a MLT field query. Like below.

{"query":{"mlt_field":{"text":{"like_text":"ministers of
defense","min_term_freq":1,"max_query_terms":12}}},"fields":["id"],"facets":{"entities.people":{"terms":{"field":"entities.people"}}}}

But I'm having trouble constructing a query for those documents. I still
need to use the mlt_field query as its the basis for my facets.
But if I try and add query_string like this:

{"query":{"mlt_field":{"text":{"like_text":"ministers of
defense","min_term_freq":1,"max_query_terms":12}},"query_string":{"fields":["text"],"query":"(entities.people:"government"
OR entities.people:"government") AND
text:"government""}},"fields":["id","locations","ratings"]}

I get a parse error.

What's the trick to add a query or filter to mlt_field? The documentation
doesn't clarify this.

thank you!!!

--
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/a71c9db6-69cc-42f3-ae3f-a727c41e6803%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

I guess you could use a BoolQuery or a FilteredQuery.
Does it help?

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 23 déc. 2013 à 02:11, project2501 darreng5150@gmail.com a écrit :

Hi,
I can get facet counts from a MLT field query. Like below.

{"query":{"mlt_field":{"text":{"like_text":"ministers of defense","min_term_freq":1,"max_query_terms":12}}},"fields":["id"],"facets":{"entities.people":{"terms":{"field":"entities.people"}}}}

But I'm having trouble constructing a query for those documents. I still need to use the mlt_field query as its the basis for my facets.
But if I try and add query_string like this:

{"query":{"mlt_field":{"text":{"like_text":"ministers of defense","min_term_freq":1,"max_query_terms":12}},"query_string":{"fields":["text"],"query":"(entities.people:"government" OR entities.people:"government") AND text:"government""}},"fields":["id","locations","ratings"]}

I get a parse error.

What's the trick to add a query or filter to mlt_field? The documentation doesn't clarify this.

thank you!!!

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/a71c9db6-69cc-42f3-ae3f-a727c41e6803%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/57D69F70-7C6B-48CE-A0A9-EDE1F0606FF5%40pilato.fr.
For more options, visit https://groups.google.com/groups/opt_out.