full-text-queries

full-text-queries

Methods

# (static) matchPhraseQuery(params) → {Object}

Assemble a matchPhraseQuery fragment. Use this when you want to match a phrase exactly.
Parameters:
Name Type Description
params Object
Properties
Name Type Description
field string the name of the field to perform the query against. Can be a dotted path like: publisher.name
value string the value to look for
Returns:
a query fragment
Type
Object
Example
matchPhraseQuery({ field: 'name.keyword', value: 'some text' })

# (static) matchQuery(params) → {Object}

Assemble a matchQuery fragment. Use this when you want to match a set of words with an operator (AND or OR) exactly.
Parameters:
Name Type Description
params Object
Properties
Name Type Description
field string the name of the field to perform the query against. Can be a dotted path like: publisher.name
value string the value to look for
operator string [ 'AND', 'OR' ] - the operator to use for the search
Returns:
a query fragment
Type
Object
Examples
matchQuery({ field: 'name.keyword', value: 'some text', operator: 'AND })
matchQuery({ field: 'name.keyword', value: 'some text', operator: 'OR})