elastic / elasticsearch-java

Official Elasticsearch Java Client
Apache License 2.0
408 stars 237 forks source link

indices.get() throws transport exception when fetching indices that have a dense_vector mapping with no dims #754

Closed ddocul closed 6 months ago

ddocul commented 6 months ago

Java API client version

8.12.2

Java version

21

Elasticsearch Version

8.12.2

Problem description

create a new mapping with a dense vector type, but omit the 'dims' parameter (optional as of 8.11)

PUT my-index
{
  "mappings": {
    "properties": {
      "my_vector": {
        "type": "dense_vector"
      },
      "my_text" : {
        "type" : "keyword"
      }
    }
  }
}

Then attempt to call indices.get() from the java api. Note response is 200, but it fails to decode the response.

co.elastic.clients.transport.TransportException: node: http://localhost:9200/, status: 200, [es/indices.get] Failed to decode response
    at co.elastic.clients.transport.ElasticsearchTransportBase.decodeTransportResponse(ElasticsearchTransportBase.java:404) ~[elasticsearch-java-8.12.2.jar:na]
    at co.elastic.clients.transport.ElasticsearchTransportBase.getApiResponse(ElasticsearchTransportBase.java:363) ~[elasticsearch-java-8.12.2.jar:na]
    at co.elastic.clients.transport.ElasticsearchTransportBase.performRequest(ElasticsearchTransportBase.java:147) ~[elasticsearch-java-8.12.2.jar:na]
    at co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient.get(ElasticsearchIndicesClient.java:965) ~[elasticsearch-java-8.12.2.jar:na]
    at co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient.get(ElasticsearchIndicesClient.java:981) ~[elasticsearch-java-8.12.2.jar:na]
l-trotta commented 6 months ago

Hello, thank you for reporting this, it's definitely an API specification used to produce the Java code. Once it's fixed the Java client code will be updated to solve this.