The _id field is one of the few reserved field names in Elasticsearch:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-id-field.html

You can set it to whatever you want, as long as it is not an object or
(empty) array, as in your case. I have no idea what the proper behavior
should be when you try to index bad data to this field, but I am not
surprised that there are issues.

-- 
Ivan


On Wed, Sep 3, 2014 at 3:12 AM, André Hänsel <[email protected]> wrote:

> When indexing a document, when there is a field named "_id" in the source,
> the fields that come after this one don't get added to the mapping, even
> though they are stored in the _source:
>
> PUT /megacorp/blah/3
> {
>   "a": "b",
>   "_id" : {},
>   "c": "d"
> }
>
> The document got stored:
>
> GET megacorp/blah/_search
> {
>    "took": 8,
>    "timed_out": false,
>    "_shards": {
>       "total": 5,
>       "successful": 5,
>       "failed": 0
>    },
>    "hits": {
>       "total": 1,
>       "max_score": 1,
>       "hits": [
>          {
>             "_index": "megacorp",
>             "_type": "blah",
>             "_id": "3",
>             "_score": 1,
>             "_source": {
>                "a": "b",
>                "_id": {},
>                "c": "d"
>             }
>          }
>       ]
>    }
> }
>
> But no mapping was added for "c":
>
> GET /megacorp/_mapping/blah
> {
>    "megacorp": {
>       "mappings": {
>          "blah": {
>             "properties": {
>                "a": {
>                   "type": "string"
>                }
>             }
>          }
>       }
>    }
> }
>
> Is this expected behavior?
>
> Regards,
> André
>
> --
> You received this message because you are subscribed to the Google Groups
> "elasticsearch" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elasticsearch/4498c028-9013-479b-a8ee-c43b8edc277f%40googlegroups.com
> <https://groups.google.com/d/msgid/elasticsearch/4498c028-9013-479b-a8ee-c43b8edc277f%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBGS4aHofD7cFmPs_320SOZ3SBi-rVjpx6DHXgFu6i4-w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to