| endpoint | exists_source |
|---|---|
| lang | java |
| es_version | 9.3 |
| client | co.elastic.clients:elasticsearch-java:9.3.0 |
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");
}This is primarily useful when working with indices where _source may
be disabled in the mapping. For most indices, client.exists() is
sufficient.