Is it possible to include "_id" in the "source" in ElasticSearch

Typically, ElasticSearch documents are stored as:

{      
    "_index": "some_index",
    "_type": "some_type",
    "_id": "blah_blah",
    "_score": null,
    "_source": {
        "field_a" : "value_a",
        "field_b" : "value_b"
        ........
}

Is it possible to include _id in the source itself when requesting data? eg

{
    "_index": "some_index",
    "_type": "some_type",
    "_id": "blah_blah",
    "_score": null,
    "_source": {
        "_id": "blah_blah", // Added in the _source object
        "field_a" : "value_a",
        "field_b" : "value_b"
        ........
}

Suppose I have no control over the data that I write, so I can’t paste it into the source code. In addition, I can read the entire object and manually turn it on, but I wonder if there is a way to do this with an ES request.

+4
source share
1 answer

The _id field is not indexed or stored, which means it does not really exist. The _type field is only indexed but not saved. _id and _type are both matedata elasticsearch, they are combined together as id # type (_uid).

0
source

All Articles