Skip to content

Commit

Permalink
Add "Cross Field" sub-section (#34142)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbismuth committed Nov 30, 2018
1 parent 8cacbe4 commit 1f19505
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/reference/query-dsl/query-string-query.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -403,4 +403,35 @@ The example above creates a boolean query:
that matches documents with at least two of the three `SHOULD` clauses, each of
them made of the disjunction max over the fields for each term.

[float]
===== Cross Field

[source,js]
--------------------------------------------------
GET /_search
{
"query": {
"query_string": {
"fields": [
"title",
"content"
],
"query": "this OR that OR thus",
"type": "cross_fields",
"minimum_should_match": 2
}
}
}
--------------------------------------------------
// CONSOLE

The `cross_fields` value in the `type` field indicates that fields that have the
same analyzer should be grouped together when the input is analyzed.

The example above creates a boolean query:

`(blended(terms:[field2:this, field1:this]) blended(terms:[field2:that, field1:that]) blended(terms:[field2:thus, field1:thus]))~2`

that matches documents with at least two of the three per-term blended queries.

include::query-string-syntax.asciidoc[]

0 comments on commit 1f19505

Please sign in to comment.