spring-data-elasticsearch
spring-data-elasticsearch copied to clipboard
How to set the value of the _source option to false ?
set _source option like this
GET /_search
{
"_source": false,
"query": {
"match": {
"user.id": "kimchy"
}
}
}
Spring Data Elasticsearch does not directly allow setting this to false, but you can use a source filter to either include no fields or exclude all fields from the source on a Spring Data Elasticsearch Query:
var query = Query.findAll();
// use either
query.addSourceFilter(FetchSourceFilter.of(b -> b.withExcludes("*")));
// or
query.addSourceFilter(FetchSourceFilter.of(b -> b.withIncludes("")));
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.