-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(dsl): Support
matchBooleanPrefix
query (#304)
- Loading branch information
Showing
6 changed files
with
241 additions
and
6 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
docs/overview/queries/elastic_query_match_boolean_prefix.md
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,31 @@ | ||
--- | ||
id: elastic_query_match_boolean_prefix | ||
title: "Match Boolean Prefix Query" | ||
--- | ||
|
||
The `MatchBooleanPrefix` query analyzes its input and constructs a `bool` query from the terms. Each term except the last is used in a `term` query. | ||
The last term is used in a `prefix` query. | ||
|
||
In order to use the `MatchBooleanPrefix` query import the following: | ||
```scala | ||
import zio.elasticsearch.query.MatchBooleanPrefixQuery | ||
import zio.elasticsearch.ElasticQuery._ | ||
``` | ||
|
||
You can create a `MatchBooleanPrefix` query using the `matchBooleanPrefix` method this way: | ||
```scala | ||
val query: MatchBooleanPrefixQuery = matchBooleanPrefix(field = "stringField", value = "test") | ||
``` | ||
|
||
You can create a [type-safe](https://lambdaworks.github.io/zio-elasticsearch/overview/overview_zio_prelude_schema) `MatchBooleanPrefix` query using the `matchBooleanPrefix` method this way: | ||
```scala | ||
val query: MatchBooleanPrefixQuery = matchBooleanPrefix(field = Document.stringField, value = "test") | ||
``` | ||
|
||
If you want to change the `minimum_should_match` parameter, you can use the `minimumShouldMatch` method: | ||
```scala | ||
val queryWithMinimumShouldMatch: MatchBooleanPrefixQuery = matchBooleanPrefix(field = Document.stringField, value = "test").minimumShouldMatch(2) | ||
``` | ||
|
||
You can find more information about `MatchBooleanPrefix` query [here](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/query-dsl-match-bool-prefix-query.html). | ||
|
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
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
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
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
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