Hi all,
I was practicing the simple DSL in Kibana dev tools page. (Elasticsearch version: 5.4.1)
There is only one document in the new index.
Create document
PUT /megacorp/employee/1
{
"first_name" : "John",
"last_name" : "Smith",
"age" : 25,
"about" : "I love to go rock climbing",
"interests": [ "sports", "music" ]
}
Then, I changed PUT
to GET
, also changed age
to 30.
GET /megacorp/employee/1
{
"first_name" : "John",
"last_name" : "Smith",
"age" : 30,
"about" : "I love to go rock climbing",
"interests": [ "sports", "music" ]
}
I just want to test whether I use the GET request with JSON content or not, then elasticsearch returns these messages:
{
"_index": "megacorp",
"_type": "employee",
"_id": "1",
"_version": 6,
"result": "updated",
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"created": false
}
Looks like the document has been updated. The age
field is 30 now.
{
"_index": "megacorp",
"_type": "employee",
"_id": "1",
"_version": 7,
"found": true,
"_source": {
"first_name": "John",
"last_name": "Smith",
"age": 30,
"about": "I love to go rock climbing",
"interests": [
"sports",
"music"
]
}
}
I know I can just use the simple one line to query documents (GET /megacorp/employee/1
),
but I'm a little curiosity about why can GET request do the update operation.
Does it work as designed?