Skip to content

Latest commit

 

History

History
31 lines (25 loc) · 743 Bytes

File metadata and controls

31 lines (25 loc) · 743 Bytes
endpoint exists_source
lang java
es_version 9.3
client co.elastic.clients:elasticsearch-java:9.3.0

Elasticsearch 9.3 exists_source endpoint (Java example)

Use client.existsSource() to check whether a document's _source field exists. Returns false if the document does not exist or if _source is disabled for the index.

var response = client.existsSource(e -> e
    .index("products")
    .id("prod-1")
);

if (response.value()) {
    System.out.println("Source available");
} else {
    System.out.println("No source available");
}

When to use this

This is primarily useful when working with indices where _source may be disabled in the mapping. For most indices, client.exists() is sufficient.