Skip to main content

Exists Request

This request is used for checking whether document exists.

To create a Exists request do the following:

import zio.elasticsearch.ElasticRequest.ExistsRequest
import zio.elasticsearch.ElasticRequest.exists
// this import is required for using `IndexName` and `DocumentId`
import zio.elasticsearch._

val request: ExistsRequest = exists(index = IndexName("index"), id = DocumentId("111"))

If you want to change the routing, you can use the routing method:

// this import is required for `Routing` also
import zio.elasticsearch._

val requestWithRouting: ExistsRequest = exists(index = IndexName("index"), id = DocumentId("111")).routing(Routing("routing"))

You can find more information about Exists request here.