Docs: Fix ambigous explanation of the "fields" parameter in `query_string` query

Closes #7292
This commit is contained in:
Britta Weber 2014-08-15 14:16:54 +02:00 committed by Clinton Gormley
parent 6a6c45e2d0
commit aa1dbc0778
1 changed files with 36 additions and 7 deletions

View File

@ -94,13 +94,42 @@ a different default field.
[float]
==== Multi Field
The `query_string` query can also run against multiple fields. The idea
of running the `query_string` query against multiple fields is by
internally creating several queries for the same query string, each with
`default_field` that match the fields provided. Since several queries
are generated, combining them can be automatically done either using a
`dis_max` query or a simple `bool` query. For example (the `name` is
boosted by 5 using `^5` notation):
The `query_string` query can also run against multiple fields. Fields can be
provided via the `"fields"` parameter (example below).
The idea of running the `query_string` query against multiple fields is to
expand each query term to an OR clause like this:
field1:query_term OR field2:query_term | ...
For example, the following query
[source,js]
--------------------------------------------------
{
"query_string" : {
"fields" : ["content", "name"],
"query" : "this AND that"
}
}
--------------------------------------------------
matches the same words as
[source,js]
--------------------------------------------------
{
"query_string": {
"query": "(content:this OR content:thus) AND (name:this OR name:thus)"
}
}
--------------------------------------------------
Since several queries are generated from the individual search terms,
combining them can be automatically done using either a `dis_max` query or a
simple `bool` query. For example (the `name` is boosted by 5 using `^5`
notation):
[source,js]
--------------------------------------------------