elastic/elasticsearch-java

Cannot disable stored fields

valasatava opened this issue · 2 comments

Java API client version

8.10.3

Java version

11

Elasticsearch Version

8.9.1

Problem description

I need to disable the retrieval of all stored_fields like _source and _id using this recipe: https://www.elastic.co/guide/en/elasticsearch/reference/current/search-fields.html#disable-stored-fields.

I use the following Java client API:

new SearchRequest.Builder().storedFields("_none_")

However, the Java client always sends "stored_fields":["none"] and subsequently throws an error:

{
  "error": {
    "root_cause": [
      {
        "type": "null_pointer_exception",
        "reason": """Cannot invoke "java.util.List.size()" because the return value of "org.elasticsearch.search.fetch.StoredFieldsContext.fieldNames()" is null"""
      }
    ],
    "type": "null_pointer_exception",
    "reason": """Cannot invoke "java.util.List.size()" because the return value of "org.elasticsearch.search.fetch.StoredFieldsContext.fieldNames()" is null"""
  },
  "status": 500
}

same as #700, #680

fixed in the code generator, will be part of the next release!