# IllegalArgumentException - DocValuesField appears more than once in this document

**URL:** <https://discuss.elastic.co/t/illegalargumentexception-docvaluesfield-appears-more-than-once-in-this-document/42538>\
**Category:** Elasticsearch\
**Created:** [February 24, 2016, 12:10am UTC](https://discuss.elastic.co/t/illegalargumentexception-docvaluesfield-appears-more-than-once-in-this-document/42538 "2016-02-24T00:10:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mpowers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mpowers/32/4824_2.png) [@mpowers](https://discuss.elastic.co/u/mpowers)\
**Post date:** [February 24, 2016, 12:10am UTC](https://discuss.elastic.co/t/illegalargumentexception-docvaluesfield-appears-more-than-once-in-this-document/42538/1 "2016-02-24T00:10:45Z")

</div>

I am seeing a strange problem. I am running Elasticsearch version 1.7.5. I have created a mapping:

```
{
   "ali-development": {
      "mappings": {
         "lead": {
            "dynamic": "false",
            "properties": {
               ...several fields omitted for brevity...
               "custom_fields": {
                  "type": "nested",
                  "include_in_root": true,
                  "properties": {
                     "custom_field_definition_id": {
                        "type": "long",
                        "doc_values": true,
                        "include_in_all": false
                     },
                     "float_value": {
                        "type": "float",
                        "doc_values": true,
                        "include_in_all": false
                     },
                     "integer_value": {
                        "type": "integer",
                        "doc_values": true,
                        "include_in_all": false
                     },
                     "option_id": {
                        "type": "long",
                        "doc_values": true,
                        "include_in_all": false
                     },
                     "string_value": {
                        "type": "string",
                        "index": "not_analyzed",
                        "doc_values": true,
                        "include_in_all": false
                     },
                     "string_value_espp_downcase": {
                        "type": "string",
                        "index": "not_analyzed",
                        "doc_values": true,
                        "include_in_all": false
                     }
                  }
               }
            }
         }
      }
   }
}

```

In my automated test suite, in the middle of a bulk indexing opertion, I am attempting to insert a document with multiple custom\_field\_definition\_ids:

```
{
    ...more data omitted...
    "custom_fields": [
      {
        "string_value": null,
        "id": 7,
        "custom_field_definition_id": 2,
        "integer_value": null,
        "float_value": 3.0,
        "option_id": null,
        "string_value_espp_downcase": null
      },
      {
        "string_value": null,
        "id": 8,
        "custom_field_definition_id": 3,
        "integer_value": 1442871695,
        "float_value": null,
        "option_id": null,
        "string_value_espp_downcase": null
      },
      {
        "string_value": null,
        "id": 9,
        "custom_field_definition_id": 4,
        "integer_value": null,
        "float_value": 1.0,
        "option_id": null,
        "string_value_espp_downcase": null
      }
    ]
  }

```

On one specific environment, this produces an error:  
{  
"index": {  
"\_index": "ali-test",  
"\_type": "lead",  
"\_id": "entity\_type:21/entity\_id:6",  
"status": 500,  
"error": "IllegalArgumentException[DocValuesField "custom\_fields.custom\_field\_definition\_id" appears more than once in this document (only one value is allowed per field)]"  
}  
},

Nothing in the [documentation for doc\_values](https://www.elastic.co/guide/en/elasticsearch/guide/current/doc-values.html) says anything about requiring values in a doc\_values field to be unique. Also, it's really strange that this error is only happening on one particular environment. I can create this document on other environments without any problems at all. What's going on? Is this a symptom of an underlying problem? Any way I can get some better diagnostic info?

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [March 8, 2016, 9:28am UTC](https://discuss.elastic.co/t/illegalargumentexception-docvaluesfield-appears-more-than-once-in-this-document/42538/2 "2016-03-08T09:28:55Z")

</div>

Hi @mpowers

I can only recreate this issue on an index created before Elasticsearch 1.4.0. Back then, numeric doc values didn't exist and we used binary doc values instead. This example works just fine on indices created from 1.4 onwards.

---

<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:** [July 5, 2017, 11:10pm UTC](https://discuss.elastic.co/t/illegalargumentexception-docvaluesfield-appears-more-than-once-in-this-document/42538/3 "2017-07-05T23:10:27Z")

</div>


