-
Notifications
You must be signed in to change notification settings - Fork 25k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Documentation for field_masking_span query (#20395)
* Documentation for field_masking_span query. Fixes #20293 * After review fixes
- Loading branch information
1 parent
1c6e3f5
commit dbeb416
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
docs/reference/query-dsl/span-field-masking-query.asciidoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
[[query-dsl-span-field-masking-query]] | ||
=== Span Field Masking Query | ||
|
||
Wrapper to allow span queries to participate in composite single-field span queries by 'lying' about their search field. The span field masking query maps to Lucene's `SpanFieldMaskingQuery` | ||
|
||
This can be used to support queries like `span-near` or `span-or` across different fields, which is not ordinarily permitted. | ||
|
||
Span field masking query is invaluable in conjunction with *multi-fields* when same content is indexed with multiple analyzers. For instance we could index a field with the standard analyzer which breaks text up into words, and again with the english analyzer which stems words into their root form. | ||
|
||
Example: | ||
|
||
[source,js] | ||
-------------------------------------------------- | ||
GET /_search | ||
{ | ||
"query": { | ||
"span_near": { | ||
"clauses": [ | ||
{ | ||
"span_term": { | ||
"text": "quick brown" | ||
} | ||
}, | ||
{ | ||
"field_masking_span": { | ||
"query": { | ||
"span_term": { | ||
"text.stems": "fox" | ||
} | ||
}, | ||
"field": "text" | ||
} | ||
} | ||
], | ||
"slop": 5, | ||
"in_order": false | ||
} | ||
} | ||
} | ||
-------------------------------------------------- | ||
// CONSOLE | ||
|
||
Note: as span field masking query returns the masked field, scoring will be done using the norms of the field name supplied. This may lead to unexpected scoring behaviour. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters