DEV Community

chanduthedev
chanduthedev

Posted on

1

ElasticSearch error message 'The [dims] property must be specified for field'

When I try to insert dense_vector values to ElasticSearch(ES), I got below error. I will explain how I resolved this error.

ES mappings

Used PUT method to create a index in ES with mappings as body

PUT http://localhost:9200/my_index

Created successfully and got below response.
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "my_index"
}

But when I try to insert values, got below error for the POST request.
POST http://localhost:9200/my_index/_creat

Request Body:

{
"name": "chanduthdev",
"vector" : [ 8.56176019e-02, 6.78501204e-02]
}

Response :

{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "The [dims] property must be specified for field [vector]."
}
],
"type": "mapper_parsing_exception",
"reason": "The [dims] property must be specified for field [vector]."
},
"status": 400
}

Solution:

To resolve this error, replace _creat with _doc in the url for the POST method.
POST http://localhost:9200/my_index/_doc

Response:

{
"_index": "my_index1",
"_type": "_doc",
"_id": "3VbDcHMBBskIYHrmDycX",
"_version": 1,
"result": "created",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"_seq_no": 0,
"_primary_term": 1
}

Happy Learning!!!

Image of Docusign

Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs