elastic/elasticsearch-java

Dense vector "element_type" field not recognized

dconnelly opened this issue · 1 comments

Java API client version

8.8.2

Java version

17

Elasticsearch Version

8.8

Problem description

Using the client to create an index with a dense vector property from the following JSON fails:

{
  "mappings": {
    "properties": {
      "vector": {
        "type": "dense_vector",
        "dims": 384,
        "element_type": "byte",
        "index": true,
        "similarity": "dot_product"
      }
}

Error message:

co.elastic.clients.json.JsonpMappingException: Error deserializing co.elastic.clients.elasticsearch._types.mapping.DenseVectorProperty: Unknown field 'element_type' (JSON path: mappings.properties.compact_vector.element_type) (in object at line no=12, column no=26, offset=340)
	at co.elastic.clients.json.ObjectDeserializer.parseUnknownField(ObjectDeserializer.java:233)
	at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:190)
	at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:148)
	at co.elastic.clients.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:77)
...

DenseVectorProperty does not seem to recognize the optional element_type field at all, even though it's documented here. Am I following the correct usage?

client.indices().create(b -> b.index(name).withJson(is)); // with JSON above as stream