mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-06 04:58:50 +00:00
The `fielddata` field and the use of the `_name` field in the short syntax of the range query have been deprecated in 5.0 and can be removed. The same goes for the deprecated `score_mode` field in HasParentQueryBuilder, the deprecated `like_text`, `ids` and `docs` parameter in the `more_like_this` query, the deprecated query name in the short version of the `regexp` query, and several deprecated alternative field names in other query builders.
34 lines
867 B
Plaintext
34 lines
867 B
Plaintext
[[query-dsl-prefix-query]]
|
|
=== Prefix Query
|
|
|
|
Matches documents that have fields containing terms with a specified
|
|
prefix (*not analyzed*). The prefix query maps to Lucene `PrefixQuery`.
|
|
The following matches documents where the user field contains a term
|
|
that starts with `ki`:
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
GET /_search
|
|
{ "query": {
|
|
"prefix" : { "user" : "ki" }
|
|
}
|
|
}
|
|
--------------------------------------------------
|
|
// CONSOLE
|
|
|
|
A boost can also be associated with the query:
|
|
|
|
[source,js]
|
|
--------------------------------------------------
|
|
GET /_search
|
|
{ "query": {
|
|
"prefix" : { "user" : { "value" : "ki", "boost" : 2.0 } }
|
|
}
|
|
}
|
|
--------------------------------------------------
|
|
// CONSOLE
|
|
|
|
This multi term query allows you to control how it gets rewritten using the
|
|
<<query-dsl-multi-term-rewrite,rewrite>>
|
|
parameter.
|