You can use term-level queries to find documents based on precise values in structured data. Examples of structured data include date ranges, IP addresses, prices, or product IDs.
Unlike full-text queries, term-level queries do not analyze search terms. Instead, term-level queries match the exact terms stored in a field.
Term-level queries still normalize search terms for keyword fields with the
normalizer property. For more details, see normalizer.
Types of term-level queries
-
existsquery - Returns documents that contain any indexed value for a field.
-
fuzzyquery - Returns documents that contain terms similar to the search term. Elasticsearch measures similarity, or fuzziness, using a Levenshtein edit distance.
-
idsquery - Returns documents based on their document IDs.
-
prefixquery - Returns documents that contain a specific prefix in a provided field.
-
rangequery - Returns documents that contain terms within a provided range.
-
regexpquery - Returns documents that contain terms matching a regular expression.
-
termquery - Returns documents that contain an exact term in a provided field.
-
termsquery - Returns documents that contain one or more exact terms in a provided field.
-
terms_setquery - Returns documents that contain a minimum number of exact terms in a provided field. You can define the minimum number of matching terms using a field or script.
-
wildcardquery - Returns documents that contain terms matching a wildcard pattern.