# Getting \[ERROR\] 'The \[dims\] property must be specified for field \[vector\].' despite being set in mapping

**URL:** <https://discuss.elastic.co/t/getting-error-the-dims-property-must-be-specified-for-field-vector-despite-being-set-in-mapping/229001>\
**Category:** Elasticsearch\
**Created:** [April 21, 2020, 9:02am UTC](https://discuss.elastic.co/t/getting-error-the-dims-property-must-be-specified-for-field-vector-despite-being-set-in-mapping/229001 "2020-04-21T09:02:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vinay\_Sharma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vinay_sharma/32/66753_2.png) [@Vinay\_Sharma](https://discuss.elastic.co/u/Vinay_Sharma)\
**Post date:** [April 21, 2020, 9:02am UTC](https://discuss.elastic.co/t/getting-error-the-dims-property-must-be-specified-for-field-vector-despite-being-set-in-mapping/229001/1 "2020-04-21T09:02:09Z")

</div>

I am trying to upload dense vectors to Elasticsearch endpoint.

1. created index with mapping as below:

```auto
mapping = {
        "mappings": {
            "properties" : {
                "vector": {
                    "type": "dense_vector",
                    "dims": 100  
                    },
                "word" : {
                    "type" : "text"
                    }
                }
            }
        }  

        es.indices.create(
        index="test",
        body=mapping
    ) 

```

response received:

```auto
{'acknowledged': True, 'shards_acknowledged': True, 'index': 'test'}

```

created a function to upload vector using bulk api as below: Model is a python dictionary with word as key and associated vector as value.

```auto
def gendata(model):
  for key, value in model.items():
    key = str(key)
    yield {
        "_index": "test",
        "_id": key,
        "_type": "document",
        "word": key,
        "vector": value
    }

```

getting below error while calling function gendata() using helpers.bulk()

NOTE: dims are set in mapping then why it is giving error that dims must be specified.

```auto
BulkIndexError: ('100 document(s) failed to index.', [{'index': {'_index': 'glove_vocabulary_100d', '_type': 'document', '_id': 'the', 'status': 400, 'error': {'type': 'mapper_parsing_exception', 'reason': 'The [dims] property must be specified for field [vector].'}, 'data': {'word': 'the', 'vector': [-0.038194, -0.24487, 0.72812, -0.39961, 0.083172, 0.043953, -0.39141, 0.3344, -0.57545, 0.087459, 0.28787, -0.06731, 0.30906, -0.26384, -0.13231, -0.20757, 0.33395, -0.33848, -0.31743, -0.48336, 0.1464, -0.37304, 0.34577, 0.052041, 0.44946, -0.46971, 0.02628, -0.54155, -0.15518, -0.14107, -0.039722, 0.28277, 0.14393, 0.23464, -0.31021, 0.086173, 0.20397, 0.52624, 0.17164, -0.082378, -0.71787, -0.41531, 0.20335, -0.12763, 0.41367, 0.55187, 0.57908, -0.33477, -0.36559, -0.54857, -0.062892, 0.26584, 0.30205, 0.99775, -0.80481, -3.0243, 0.01254, -0.36942, 2.2167, 0.72201, -0.24978, 0.92136, 0.034514, 0.46745, 1.1079, -0.19358, -0.074575, 0.23353, -0.052062, -0.22044, 0.057162, -0.15806, -0.30798, -0.41625, 0.37972, 0.15006, -0.53212, -0.2055, -1.2526, 0.071624, 0.70565, 0.49744, -0.42063, 0.26148, -1.538, -0.30223, -0.073438, -0.28312, 0.37104, -0.25217, 0.016215, -0.017099, -0.38984, 0.87424, -0.72569, -0.51058, -0.52028, -0.1459, 0.8278, 0.27062]}}}

```

---

<div class="post-metadata">

**Author:** ![mayya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mayya/32/83147_2.png) [@mayya](https://discuss.elastic.co/u/mayya)\
**Post date:** [April 27, 2020, 10:38am UTC](https://discuss.elastic.co/t/getting-error-the-dims-property-must-be-specified-for-field-vector-despite-being-set-in-mapping/229001/2 "2020-04-27T10:38:36Z")

</div>

What ES version are you using?  
Do direct http request (not using a python client) work for you?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 25, 2020, 10:38am UTC](https://discuss.elastic.co/t/getting-error-the-dims-property-must-be-specified-for-field-vector-despite-being-set-in-mapping/229001/3 "2020-05-25T10:38:48Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
