본문 바로가기

빅데이터/Elasticsearch

엘라스틱서치에 중복 id로 값을 보내면?

엘라스틱서치에 중복id로 값을 보내면 버젼이 올라간다.

$ curl --location --request PUT 'localhost:9200/books/book/2d12dd2' \
--header 'Content-Type: application/json' \
--data-raw '{
   "_id":"1",
"tile": "Nesoy Elastic Guide",
"author": "Nesoy",
"date": "2019-01-15",
"pages": 250
}'
{
    "_index": "books",
    "_type": "book",
    "_id": "2d12dd2",
    "_version": 2,
    "result": "updated",
    "_shards": {
        "total": 2,
        "successful": 1,
        "failed": 0
    },
    "_seq_no": 2,
    "_primary_term": 1
}

_id는 2d12dd2이고 _version이 2로 높아진 것을 확인할 수 있습니다.

 

_id field Each document has an _id that uniquely identifies it, which is indexed so that documents can be looked up either with the GET API or the ids query.

참고 자료

www.elastic.co/guide/en/elasticsearch/reference/current/mapping-id-field.html

 

_id field | Elasticsearch Reference [7.9] | Elastic

_id is limited to 512 bytes in size and larger values will be rejected.

www.elastic.co

 

반응형