Exists Query
The Exists
query is used for returning documents that contain an indexed value for a field.
In order to use the Exists
query import the following:
import zio.elasticsearch.query.ExistsQuery
import zio.elasticsearch.ElasticQuery._
You can create an Exists
query using the exists
method this way:
val query: ExistsQuery = exists(field = "name")
Also, you can create a type-safe Exists
query using the exists
method this way:
val query: ExistsQuery = exists(field = Document.name)
If you want to change the boost
, you can use boost
method:
val queryWithBoost: ExistsQuery = exists(field = "name").boost(2.0)
You can find more information about Exists
query here.