Skip to content

Commit 88d06e1

Browse files
Add full-text query documentation (opensearch-project#5428)
* Refactor full-text query documentation Signed-off-by: Fanit Kolchina <[email protected]> * Add examples and parameter descriptions Signed-off-by: Fanit Kolchina <[email protected]> * Add multi-match query Signed-off-by: Fanit Kolchina <[email protected]> * Add query string field format Signed-off-by: Fanit Kolchina <[email protected]> * Query string examples Signed-off-by: Fanit Kolchina <[email protected]> * Add regular expressions and fuzziness Signed-off-by: Fanit Kolchina <[email protected]> * Add wildcard and regex warning Signed-off-by: Fanit Kolchina <[email protected]> * Added more query string format Signed-off-by: Fanit Kolchina <[email protected]> * Added multi-field sections Signed-off-by: Fanit Kolchina <[email protected]> * Rewrite minimum should match section Signed-off-by: Fanit Kolchina <[email protected]> * Added allow expensive queries section Signed-off-by: Fanit Kolchina <[email protected]> * Add simple query string query Signed-off-by: Fanit Kolchina <[email protected]> * Small rewrites Signed-off-by: Fanit Kolchina <[email protected]> * Add intervals query Signed-off-by: Fanit Kolchina <[email protected]> * Include discover in query string syntax Signed-off-by: Fanit Kolchina <[email protected]> * Link and index page fix Signed-off-by: Fanit Kolchina <[email protected]> * Apply suggestions from code review Co-authored-by: Melissa Vagi <[email protected]> Signed-off-by: kolchfa-aws <[email protected]> * Implemented editorial comments Signed-off-by: Fanit Kolchina <[email protected]> --------- Signed-off-by: Fanit Kolchina <[email protected]> Signed-off-by: kolchfa-aws <[email protected]> Co-authored-by: Melissa Vagi <[email protected]>
1 parent b5ed6c7 commit 88d06e1

File tree

25 files changed

+3527
-526
lines changed

25 files changed

+3527
-526
lines changed

_field-types/supported-field-types/flat-object.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ The flat object field type supports the following queries:
5050
- [Terms set]({{site.url}}{{site.baseurl}}/query-dsl/term/terms-set/)
5151
- [Prefix]({{site.url}}{{site.baseurl}}/query-dsl/term/prefix/)
5252
- [Range]({{site.url}}{{site.baseurl}}/query-dsl/term/range/)
53-
- [Match]({{site.url}}{{site.baseurl}}/query-dsl/full-text/#match)
54-
- [Multi-match]({{site.url}}{{site.baseurl}}/query-dsl/full-text/#multi-match)
53+
- [Match]({{site.url}}{{site.baseurl}}/query-dsl/full-text/match/)
54+
- [Multi-match]({{site.url}}{{site.baseurl}}/query-dsl/full-text/multi-match/)
5555
- [Query string]({{site.url}}{{site.baseurl}}/query-dsl/full-text/query-string/)
56-
- [Simple query string]({{site.url}}{{site.baseurl}}/query-dsl/full-text/#simple-query-string)
56+
- [Simple query string]({{site.url}}{{site.baseurl}}/query-dsl/full-text/simple-query-string/)
5757
- [Exists]({{site.url}}{{site.baseurl}}/query-dsl/term/exists/)
5858

5959
## Limitations

_query-dsl/compound/bool.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ redirect_from:
1010
- /query-dsl/query-dsl/compound/bool/
1111
---
1212

13-
# Boolean queries
13+
# Boolean query
1414

1515
A Boolean (`bool`) query can combine several query clauses into one advanced query. The clauses are combined with Boolean logic to find matching documents returned in the results.
1616

_query-dsl/compound/boosting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ redirect_from:
88
- /query-dsl/query-dsl/compound/boosting/
99
---
1010

11-
# Boosting queries
11+
# Boosting query
1212

1313
If you're searching for the word "pitcher", your results may relate to either baseball players or containers for liquids. For a search in the context of baseball, you might want to completely exclude results that contain the words "glass" or "water" by using the `must_not` clause. However, if you want to keep those results but downgrade them in relevance, you can do so with `boosting` queries.
1414

_query-dsl/compound/constant-score.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ redirect_from:
88
- /query-dsl/query-dsl/compound/constant-score/
99
---
1010

11-
# Constant score queries
11+
# Constant score query
1212

13-
If you need to return documents that contain a certain word regardless of how many times the word appears, you can use a `constant_ score` query. A `constant_score` query wraps a filter query and assigns all documents in the results a relevance score equal to the value of the `boost` parameter. Thus, all returned documents have an equal relevance score, and term frequency/inverse document frequency (TF/IDF) is not considered. Filter queries do not calculate relevance scores. Further, OpenSearch caches frequently used filter queries to improve performance.
13+
If you need to return documents that contain a certain word regardless of how many times the word appears, you can use a `constant_score` query. A `constant_score` query wraps a filter query and assigns all documents in the results a relevance score equal to the value of the `boost` parameter. Thus, all returned documents have an equal relevance score, and term frequency/inverse document frequency (TF/IDF) is not considered. Filter queries do not calculate relevance scores. Further, OpenSearch caches frequently used filter queries to improve performance.
1414

1515
## Example
1616

_query-dsl/compound/disjunction-max.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ redirect_from:
88
- /query-dsl/query-dsl/compound/disjunction-max/
99
---
1010

11-
# Disjunction max queries
11+
# Disjunction max query
1212

1313
A disjunction max (`dis_max`) query returns any document that matches one or more query clauses. For documents that match multiple query clauses, the relevance score is set to the highest relevance score from all matching query clauses.
1414

@@ -25,6 +25,7 @@ PUT testindex1/_doc/1
2525
"description": "Top 10 sonnets of England's national poet and the Bard of Avon"
2626
}
2727
```
28+
{% include copy-curl.html %}
2829

2930
```json
3031
PUT testindex1/_doc/2
@@ -33,8 +34,9 @@ PUT testindex1/_doc/2
3334
"body": "The poems written by various 16-th century poets"
3435
}
3536
```
37+
{% include copy-curl.html %}
3638

37-
Use a `dis_max` query to search for documents that contain the words "Shakespeare works":
39+
Use a `dis_max` query to search for documents that contain the words "Shakespeare poems":
3840

3941
```json
4042
GET testindex1/_search

_query-dsl/compound/function-score.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ redirect_from:
99
- /query-dsl/query-dsl/compound/function-score/
1010
---
1111

12-
# Function score queries
12+
# Function score query
1313

1414
Use a `function_score` query if you need to alter the relevance scores of documents returned in the results. A `function_score` query defines a query and one or more functions that can be applied to all results or subsets of the results to recalculate their relevance scores.
1515

_query-dsl/compound/index.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,24 @@
22
layout: default
33
title: Compound queries
44
has_children: true
5+
has_toc: false
56
nav_order: 40
67
redirect_from:
7-
- /opensearch/query-dsl/compound/index/
8+
- /query-dsl/compound/index/
89
- /query-dsl/query-dsl/compound/
910
---
1011

1112
# Compound queries
1213

1314
Compound queries serve as wrappers for multiple leaf or compound clauses either to combine their results or to modify their behavior.
1415

15-
OpenSearch supports the following compound query types:
16+
The following table lists all compound query types.
1617

17-
- **Boolean**: Combines multiple query clauses with Boolean logic. To learn more, see [Boolean queries]({{site.url}}{{site.baseurl}}/opensearch/query-dsl/compound/bool/).
18-
- **Constant score**: Wraps a query or a filter and assigns a constant score to all matching documents. This score is equal to the `boost` value.
19-
- **Disjunction max**: Returns documents that match one or more query clauses. If a document matches multiple query clauses, it is assigned a higher relevance score. The relevance score is calculated using the highest score from any matching clause and, optionally, the scores from the other matching clauses multiplied by the tiebreaker value.
20-
- **Function score**: Recalculates the relevance score of documents that are returned by a query using a function that you define.
21-
- **Boosting**: Changes the relevance score of documents without removing them from the search results. Returns documents that match a `positive` query, but downgrades the relevance of documents in the results that match a `negative` query.
18+
Query type | Description
19+
:--- | :---
20+
[`bool`]({{site.url}}{{site.baseurl}}/query-dsl/compound/bool/) (Boolean)| Combines multiple query clauses with Boolean logic.
21+
[`boosting`]({{site.url}}{{site.baseurl}}/query-dsl/compound/boosting/) | Changes the relevance score of documents without removing them from the search results. Returns documents that match a `positive` query, but downgrades the relevance of documents in the results that match a `negative` query.
22+
[`constant_score`]({{site.url}}{{site.baseurl}}/query-dsl/compound/constant-score/) | Wraps a query or a filter and assigns a constant score to all matching documents. This score is equal to the `boost` value.
23+
[`dis_max`]({{site.url}}{{site.baseurl}}/query-dsl/compound/disjunction-max/) (disjunction max) | Returns documents that match one or more query clauses. If a document matches multiple query clauses, it is assigned a higher relevance score. The relevance score is calculated using the highest score from any matching clause and, optionally, the scores from the other matching clauses multiplied by the tiebreaker value.
24+
[`function_score`]({{site.url}}{{site.baseurl}}/query-dsl/compound/function-score/) | Recalculates the relevance score of documents that are returned by a query using a function that you define.
25+
[`hybrid`]({{site.url}}{{site.baseurl}}/query-dsl/compound/hybrid/) | Combines relevance scores from multiple queries into one score for a given document.

0 commit comments

Comments
 (0)