[Doc] add terms for site search to return pages correctly for bool and range queries (#1229)
* for rewrites to range queries Signed-off-by: alicejw <alicejw@amazon.com> * for seeding terms to pull up range and bool query pages in site searches Signed-off-by: alicejw <alicejw@amazon.com> * minor wording fix Signed-off-by: alicejw <alicejw@amazon.com> * reword compound query description Signed-off-by: alicejw <alicejw@amazon.com> * for range query rewrites Signed-off-by: alicejw <alicejw@amazon.com> * for doc review comments Signed-off-by: alicejw <alicejw@amazon.com> Signed-off-by: alicejw <alicejw@amazon.com>
This commit is contained in:
parent
86f6d20048
commit
0a0968ac94
|
@ -7,13 +7,13 @@ nav_order: 45
|
|||
|
||||
# Boolean queries
|
||||
|
||||
The `bool` query lets you combine multiple search queries with boolean logic. You can use boolean logic between queries to either narrow or broaden your search results.
|
||||
You can perform a Boolean query with the `bool` query type. A Boolean query compounds query clauses so you can combine multiple search queries with Boolean logic. To narrow or broaden your search results, use the `bool` query clause rules.
|
||||
|
||||
The `bool` query is a go-to query because it allows you to construct an advanced query by chaining together several simple ones.
|
||||
As a compound query type, `bool` allows you to construct an advanced query by chaining together several simple ones.
|
||||
|
||||
Use the following clauses (subqueries) within the `bool` query:
|
||||
Use the following rules to define how to combine multiple sub-query clauses within a `bool` query:
|
||||
|
||||
Clause | Behavior
|
||||
Clause rule | Behavior
|
||||
:--- | :---
|
||||
`must` | The results must match the queries in this clause. If you have multiple queries, every single one must match. Acts as an `and` operator.
|
||||
`must_not` | This is the anti-must clause. All matches are excluded from the results. Acts as a `not` operator.
|
||||
|
@ -200,7 +200,7 @@ OpenSearch returns a `matched_queries` array that lists the queries that matched
|
|||
If you remove the queries not in this list, you will still see the exact same result.
|
||||
By examining which `should` clause matched, you can better understand the relevancy score of the results.
|
||||
|
||||
You can also construct complex boolean expressions by nesting `bool` queries.
|
||||
You can also construct complex Boolean expressions by nesting `bool` queries.
|
||||
For example, to find a `text_entry` field that matches (`love` OR `hate`) AND (`life` OR `grace`) in the play `Romeo and Juliet`:
|
||||
|
||||
```json
|
||||
|
|
|
@ -283,9 +283,9 @@ GET shakespeare/_search
|
|||
}
|
||||
```
|
||||
|
||||
## Range
|
||||
## Range query
|
||||
|
||||
Use the `range` query to search for a range of values in a field.
|
||||
You can search for a range of values in a field with the `range` query.
|
||||
|
||||
To search for documents where the `line_id` value is >= 10 and <= 20:
|
||||
|
||||
|
@ -310,6 +310,9 @@ Parameter | Behavior
|
|||
`lte` | Less than or equal to.
|
||||
`lt` | Less than.
|
||||
|
||||
In addition to the range query parameters, you can provide date formats or relation operators such as "contains" or "within." To see the supported field types for range queries, see [Range query optional parameters]({{site.url}}{{site.baseurl}}/opensearch/supported-field-types/range/#range-query-optional-parameters). To see all date formats, see [Formats]({{site.url}}{{site.baseurl}}/opensearch/supported-field-types/date/#formats).
|
||||
{: .tip }
|
||||
|
||||
Assume that you have a `products` index and you want to find all the products that were added in the year 2019:
|
||||
|
||||
```json
|
||||
|
|
|
@ -77,16 +77,19 @@ GET testindex/_search
|
|||
}
|
||||
```
|
||||
|
||||
### Range query
|
||||
### Range query optional parameters
|
||||
|
||||
A range query on a range field returns documents within that range. Along with the field to be matched, range queries take the following optional parameters.
|
||||
A range query on a range field returns documents within that range. Along with the field to be matched, you can further specify a date format or relational operators with the following optional parameters:
|
||||
|
||||
Parameter | Description
|
||||
:--- | :---
|
||||
Parameter | Description
|
||||
:--- | :---
|
||||
format | A [format]({{site.url}}{{site.baseurl}}/opensearch/supported-field-types/date/#formats) for dates in this query. Default is the field's mapped format.
|
||||
relation | Provides a relation between the query's date range and the document's date range. There are three types of relations that you can specify:<br> 1. `intersects` matches documents for which there are dates that belong to both the query's date range and document's date range. This is the default. <br> 2. `contains` matches documents for which the query's date range is a subset of the document's date range. <br> 3. `within` matches documents for which the document's date range is a subset of the query's date range.
|
||||
|
||||
To use a date format other than the field's mapped format in a query, specify it in the `format` field.
|
||||
To use a date format other than the field's mapped format in a query, specify it in the `format` field.
|
||||
|
||||
To see the full description of range query usage, including all range query parameters, see [Range query]({{site.url}}{{site.baseurl}}/opensearch/query-dsl/term/#range-query).
|
||||
{: .tip }
|
||||
|
||||
Query for all graduation dates in 2019, providing the date range in a "MM/dd/yyyy" format:
|
||||
|
||||
|
|
Loading…
Reference in New Issue