0

Based on the documentation, I am trying to create an index with the nested vector field using byte as the underlying data type:

PUT docs_byte
{
    "settings" : {
        "index" : {
            "number_of_shards" : 1, 
            "number_of_replicas" : 1
        }
    },
    "mappings": {
        "properties": {
            "title": {
                "type": "text"
            },
            "ideas": {
                "type": "nested",
                "properties": {
                    "vector": {
                        "type": "knn_vector",
                        "dimension": 384,
                        "data_type": "byte"
                    }
                }
            }
        }
    }
}

I get the error unknown parameter [data_type] on mapper [vector] of type [knn_vector]. What am I missing?

AlwaysLearning
  • 7,257
  • 4
  • 33
  • 68

1 Answers1

0

The byte data_type is only supported by the the lucene engine, so you need to declare your field like this:

PUT docs_byte
{
    "settings" : {
        "index" : {
            "number_of_shards" : 1, 
            "number_of_replicas" : 1
        }
    },
    "mappings": {
        "properties": {
            "title": {
                "type": "text"
            },
            "ideas": {
                "type": "nested",
                "properties": {
                    "vector": {
                        "type": "knn_vector",
                        "dimension": 384,
                        "data_type": "byte",
                        "method": {
                            "name": "hnsw",
                            "space_type": "l2",
                            "engine": "lucene",        <------ add this
                            "parameters": {
                                "ef_construction": 128,
                                "m": 24
                            }
                        }
                    }
                }
            }
        }
    }
}
Val
  • 207,596
  • 13
  • 358
  • 360