I am testing different query options and want to try combining
different query elements together with a boosting factor. So for
example, suppose I want to use a more_like_this query for some
like_text against a field AND I would like to use a trem query against
a different field. And I would like to combine these elements such
that the term query is boosted by a factor of 2.
Assume the fields are field_a, field_b and field_c (all strings).
Assume the first query element is:- "more_like_this": {"like_text":
"text like this", fields: ["field_a", "field_b"]}
Assume the second query element is:- "term": {"field_c": {"value":
"foo", "boost": 2.0}}
And the question is, what is the right syntax to put these together in
a query?
You can put them in a bool query should/must clauses.
On Wednesday, May 11, 2011 at 12:55 AM, Conor wrote:
Hello all.
I am testing different query options and want to try combining
different query elements together with a boosting factor. So for
example, suppose I want to use a more_like_this query for some
like_text against a field AND I would like to use a trem query against
a different field. And I would like to combine these elements such
that the term query is boosted by a factor of 2.
Assume the fields are field_a, field_b and field_c (all strings).
Assume the first query element is:- "more_like_this": {"like_text":
"text like this", fields: ["field_a", "field_b"]}
Assume the second query element is:- "term": {"field_c": {"value":
"foo", "boost": 2.0}}
And the question is, what is the right syntax to put these together in
a query?
Thanks. It was not intuitive to me that a boolean combination of fuzzy component queries (i.e. not an underlying boolean value but a score) were the semantics, but it does the job nicely.
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.