-
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.
- Loading branch information
1 parent
813252f
commit 0c1e2b3
Showing
3 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
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,30 @@ | ||
--- | ||
id: elastic_aggregation_missing | ||
title: "Missing Aggregation" | ||
--- | ||
|
||
The `Missing` aggregation is a field data based single bucket aggregation, that creates a bucket of all documents in the current document set context that are missing a field value. | ||
|
||
In order to use the `Missing` aggregation import the following: | ||
```scala | ||
import zio.elasticsearch.aggregation.MissingAggregation | ||
import zio.elasticsearch.ElasticAggregation.missingAggregation | ||
``` | ||
|
||
You can create a `Missing` aggregation using the `missingAggregation` method this way: | ||
```scala | ||
val aggregation: MissingAggregation = missingAggregation(name = "missingAggregation", field = "stringField") | ||
``` | ||
|
||
You can create a [type-safe](https://lambdaworks.github.io/zio-elasticsearch/overview/overview_zio_prelude_schema) `Missing` aggregation using the `missingAggregation` method this way: | ||
```scala | ||
// Document.stringField must be string value, because of Missing aggregation | ||
val aggregation: MissingAggregation = missingAggregation(name = "missingAggregation", field = Document.stringField) | ||
``` | ||
|
||
If you want to add aggregation (on the same level), you can use `withAgg` method: | ||
```scala | ||
val multipleAggregations: MultipleAggregations = missingAggregation(name = "missingAggregation1", field = Document.stringField).withAgg(missingAggregation(name = "missingAggregation2", field = Document.stringField)) | ||
``` | ||
|
||
You can find more information about `Missing` aggregation [here](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/search-aggregations-bucket-missing-aggregation.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