Skip to content

Commit 71a5982

Browse files
author
Adam Locke
authored
[DOCS] Update combined fields wording (#76893) (#76993)
* [DOCS] Update combined fields wording * Clarifications from review feedback
1 parent 7c9ac4b commit 71a5982

File tree

2 files changed

+33
-30
lines changed

2 files changed

+33
-30
lines changed

docs/reference/query-dsl/combined-fields-query.asciidoc

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
++++
66

77
The `combined_fields` query supports searching multiple text fields as if their
8-
contents had been indexed into one combined field. It takes a term-centric
9-
view of the query: first it analyzes the query string into individual terms,
8+
contents had been indexed into one combined field. The query takes a term-centric
9+
view of the input string: first it analyzes the query string into individual terms,
1010
then looks for each term in any of the fields. This query is particularly
1111
useful when a match could span multiple text fields, for example the `title`,
12-
`abstract` and `body` of an article:
12+
`abstract`, and `body` of an article:
1313

1414
[source,console]
15-
--------------------------------------------------
15+
----
1616
GET /_search
1717
{
1818
"query": {
@@ -23,31 +23,36 @@ GET /_search
2323
}
2424
}
2525
}
26-
--------------------------------------------------
26+
----
2727

2828
The `combined_fields` query takes a principled approach to scoring based on the
2929
simple BM25F formula described in
3030
http://www.staff.city.ac.uk/~sb317/papers/foundations_bm25_review.pdf[The Probabilistic Relevance Framework: BM25 and Beyond].
3131
When scoring matches, the query combines term and collection statistics across
32-
fields. This allows it to score each match as if the specified fields had been
33-
indexed into a single combined field. (Note that this is a best attempt --
34-
`combined_fields` makes some approximations and scores will not obey this
35-
model perfectly.)
32+
fields to score each match as if the specified fields had been indexed into a
33+
single, combined field. This scoring is a best attempt; `combined_fields` makes
34+
some approximations and scores will not obey the BM25F model perfectly.
3635

36+
// tag::max-clause-limit[]
3737
[WARNING]
3838
.Field number limit
3939
===================================================
40-
There is a limit on the number of fields that can be queried at once. It is
41-
defined by the `indices.query.bool.max_clause_count` <<search-settings>>
42-
which defaults to 1024.
40+
By default, there is a limit to the number of clauses a query can contain. This
41+
limit is defined by the
42+
<<indices-query-bool-max-clause-count,`indices.query.bool.max_clause_count`>>
43+
setting, which defaults to `1024`. For `combined_fields` queries, the number of
44+
clauses is calculated as the number of fields multiplied by the number of terms.
4345
===================================================
46+
// end::max-clause-limit[]
4447

4548
==== Per-field boosting
4649

47-
Individual fields can be boosted with the caret (`^`) notation:
50+
Field boosts are interpreted according to the combined field model. For example,
51+
if the `title` field has a boost of 2, the score is calculated as if each term
52+
in the title appeared twice in the synthetic combined field.
4853

4954
[source,console]
50-
--------------------------------------------------
55+
----
5156
GET /_search
5257
{
5358
"query": {
@@ -57,11 +62,8 @@ GET /_search
5762
}
5863
}
5964
}
60-
--------------------------------------------------
61-
62-
Field boosts are interpreted according to the combined field model. For example,
63-
if the `title` field has a boost of 2, the score is calculated as if each term
64-
in the title appeared twice in the synthetic combined field.
65+
----
66+
<1> Individual fields can be boosted with the caret (`^`) notation.
6567

6668
NOTE: The `combined_fields` query requires that field boosts are greater than
6769
or equal to 1.0. Field boosts are allowed to be fractional.
@@ -149,7 +151,7 @@ term-centric: `operator` and `minimum_should_match` are applied per-term,
149151
instead of per-field. Concretely, a query like
150152

151153
[source,console]
152-
--------------------------------------------------
154+
----
153155
GET /_search
154156
{
155157
"query": {
@@ -160,12 +162,15 @@ GET /_search
160162
}
161163
}
162164
}
163-
--------------------------------------------------
165+
----
164166

165-
is executed as
167+
is executed as:
166168

167-
+(combined("database", fields:["title" "abstract"]))
168-
+(combined("systems", fields:["title", "abstract"]))
169+
[source,txt]
170+
----
171+
+(combined("database", fields:["title" "abstract"]))
172+
+(combined("systems", fields:["title", "abstract"]))
173+
----
169174

170175
In other words, each term must be present in at least one field for a
171176
document to match.
@@ -178,8 +183,8 @@ to scoring based on the BM25F algorithm.
178183
[NOTE]
179184
.Custom similarities
180185
===================================================
181-
The `combined_fields` query currently only supports the `BM25` similarity
182-
(which is the default unless a <<index-modules-similarity, custom similarity>>
183-
is configured). <<similarity, Per-field similarities>> are also not allowed.
186+
The `combined_fields` query currently only supports the BM25 similarity,
187+
which is the default unless a <<index-modules-similarity, custom similarity>>
188+
is configured. <<similarity, Per-field similarities>> are also not allowed.
184189
Using `combined_fields` in either of these cases will result in an error.
185190
===================================================

docs/reference/query-dsl/multi-match-query.asciidoc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,7 @@ index settings, which in turn defaults to `*`. `*` extracts all fields in the ma
6767
are eligible to term queries and filters the metadata fields. All extracted fields are then
6868
combined to build a query.
6969

70-
WARNING: There is a limit on the number of fields that can be queried
71-
at once. It is defined by the `indices.query.bool.max_clause_count` <<search-settings>>
72-
which defaults to 1024.
70+
include::combined-fields-query.asciidoc[tag=max-clause-limit]
7371

7472
[[multi-match-types]]
7573
[discrete]

0 commit comments

Comments
 (0)