opensearch-docs-cn/_query-dsl/term/index.md

32 lines
2.2 KiB
Markdown
Raw Normal View History

---
layout: default
title: Term-level queries
has_children: true
Add full-text query documentation (#5428) * Refactor full-text query documentation Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Add examples and parameter descriptions Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Add multi-match query Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Add query string field format Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Query string examples Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Add regular expressions and fuzziness Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Add wildcard and regex warning Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Added more query string format Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Added multi-field sections Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Rewrite minimum should match section Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Added allow expensive queries section Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Add simple query string query Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Small rewrites Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Add intervals query Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Include discover in query string syntax Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Link and index page fix Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> * Apply suggestions from code review Co-authored-by: Melissa Vagi <vagimeli@amazon.com> Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> * Implemented editorial comments Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> --------- Signed-off-by: Fanit Kolchina <kolchfa@amazon.com> Signed-off-by: kolchfa-aws <105444904+kolchfa-aws@users.noreply.github.com> Co-authored-by: Melissa Vagi <vagimeli@amazon.com>
2023-11-01 09:29:13 -04:00
has_toc: false
nav_order: 20
---
# Term-level queries
Term-level queries search an index for documents that contain an exact search term. Documents returned by a term-level query are not sorted by their relevance scores.
When working with text data, use term-level queries for fields mapped as `keyword` only.
Term-level queries are not suited for searching analyzed text fields. To return analyzed fields, use a [full-text query]({{site.url}}{{site.baseurl}}/opensearch/query-dsl/full-text/).
## Term-level query types
The following table lists all term-level query types.
Query type | Description
:--- | :---
[`term`]({{site.url}}{{site.baseurl}}/query-dsl/term/term/) | Searches for documents containing an exact term in a specific field.
[`terms`]({{site.url}}{{site.baseurl}}/query-dsl/term/terms/) | Searches for documents containing one or more terms in a specific field.
[`terms_set`]({{site.url}}{{site.baseurl}}/query-dsl/term/terms-set/) | Searches for documents that match a minimum number of terms in a specific field.
[`ids`]({{site.url}}{{site.baseurl}}/query-dsl/term/ids/) | Searches for documents by document ID.
[`range`]({{site.url}}{{site.baseurl}}/query-dsl/term/range/) | Searches for documents with field values in a specific range.
[`prefix`]({{site.url}}{{site.baseurl}}/query-dsl/term/prefix/) | Searches for documents containing terms that begin with a specific prefix.
[`exists`]({{site.url}}{{site.baseurl}}/query-dsl/term/exists/) | Searches for documents with any indexed value in a specific field.
[`fuzzy`]({{site.url}}{{site.baseurl}}/query-dsl/term/fuzzy/) | Searches for documents containing terms that are similar to the search term within the maximum allowed [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance). The Levenshtein distance measures the number of one-character changes needed to change one term to another term.
[`wildcard`]({{site.url}}{{site.baseurl}}/query-dsl/term/wildcard/) | Searches for documents containing terms that match a wildcard pattern.
[`regexp`]({{site.url}}{{site.baseurl}}/query-dsl/term/regexp/) | Searches for documents containing terms that match a regular expression.