Reputation: 14717
I am new to Elasticsearch. I wonder how to use different queries on different fields in a single query. For example, match query on field 1 and field 2, term query on field 3.
Any info is really appreciated.
Thanks and regards.
Upvotes: 0
Views: 104
Reputation: 27487
You should take a look at the Elasticsearch Bool Query:
Bool Query
A query that matches documents matching boolean combinations of other queries. The bool query maps to Lucene BooleanQuery. It is built using one or more boolean clauses, each clause with a typed occurrence.
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html
And the related Bool Filter:
Bool Filter
A filter that matches documents matching boolean combinations of other queries. Similar in concept to Boolean query, except that the clauses are other filters. Can be placed within queries that accept a filter.
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-bool-filter.html
Upvotes: 1