-
Notifications
You must be signed in to change notification settings - Fork 282
Closed
Labels
Description
Java API client version
8.9.1
Java version
17
Elasticsearch Version
8.10.2
Problem description
Elasticsearch allows stored fields to be disabled entirely by setting "stored_fields": "_none_" in search requests (https://www.elastic.co/guide/en/elasticsearch/reference/current/search-fields.html#disable-stored-fields).
There's no way to set this using the Java API client however, as the builders (and the JSON the Java API client generates) always generate a list of strings for the stored_fields parameter.
If a request is created from JSON directly, using e.g.:
var req = new SearchRequest.Builder()
.withJson(new StringReader(
"{\"stored_fields\": \"_none_\"}"
));when that search is sent, the Java API client generates JSON containing:
{"stored_fields": ["_none_"]}This then causes a null pointer exception when the request is actually sent:
Cannot invoke "java.util.List.size()" because the return value of "org.elasticsearch.search.fetch.StoredFieldsContext.fieldNames()" is null
Reactions are currently unavailable