A match all query simply matches all documents (namespace and document type). This query comes in handy if you just want to filter a search result or really do not have any constraints.
Example:
1"query":{2 "match_all_query":{}3}
term_query
A term query matches one (or more) value(s) against one (or more) document field(s). A document is considered a hit if one of the values matches (exactly) with at least one of the given fields. The operator “is” can only take one value, while “one_of” can take multiple values. If multiple fields are specified, they are combined using the OR operator. The less and greater operators are not compatible with some search types. To query based on numeric bounds in those cases, you can use a range filter on a filtered query.
Elastic only: If used with multiple fields, the query is internally handled as a boolean OR of DisjointMaxQueries (with the dismax matching a value against all fields). The dismax makes sure that a document carrying a single term in multiple fields does not get higher scores than a document matching multiple terms in multiple fields.
The values, the field(s) are compared against, combined with the operator.
text_query
A text query is used to match some text (i.e. a search phrase possibly consisting of multiple terms) against one or multiple fields. In case multiple fields are provided, the phrase conceptually forms a logical OR over the fields. In this case, the terms of the phrase basically have to match within the text, that would result in concatenating all given fields.
The document fields the search phrase has to match against.
search_phrase
String
mandatory=true, nullable=false
A search phrase, which may consist of multiple terms.
boolean_query
A boolean query allows construction of full logical expression trees consisting of other queries (usually term and text queries). A boolean query basically has 3 sets of clauses that ‘must’, ‘should’ and / or ‘must not’ match. If ‘must’, ‘must_not’, or ‘should’ appear in the same boolean query, they are combined logically using the AND operator. Example: (id = ‘foo’ AND description LIKE ‘bar’)
A nested query queries nested documents that are part of a larger document. The classical example is a product master with variants (in one big document) where you want to constrain a search to masters that have variants that match multiple constraints (like color = blue AND size = M). This query is not compatible with some search types.
Example: finds all the documents that has firstname = “John” and lastname = “Doe”
The Open Commerce API (OCAPI) is now deprecated. The provisions described in our versioning and deprecation policy fully apply. For all new projects and major refactoring work, use B2C Commerce API (SCAPI) as the default REST API. For additional details, refer to Why Use SCAPI Instead of OCAPI.
DID THIS ARTICLE SOLVE YOUR ISSUE? Let us know so we can improve!