Continue to section 6
4. Update documentation
Update operation | Parameters or conclusion |
---|---|
POST customer/external/1/_update |
{
“doc”: { “name”: “Jane Doe”, “age”: 20 } } |
Or POST customer/external/1 |
{
“name”: “John Nash2” } |
Or PUT customer/external/1 |
{
“name”: “John Nash3” } |
different | The POST operation will compare the source document data. If it is the same, there will be no operation. The document version and _seq_no will not increase; the PUT operation will always save the data and increase the version version; if the metadata is the same with _update, no operation will be performed. |
Watch the scene | For large concurrent updates, there is no update; for large concurrent queries occasionally update, with update; compare updates, recalculate the distribution rules. |
Update and add attributes POST customer/external/1/_update |
{ “doc”: { “name”: “Jane Doe”, “age”: 20 }}
|
Update and add attributes PUT&POST customer/external/1 |
{
“name”: “John Nash2”, “age”: 40 } |
Used with _update
the post data update request using the post method postman transmission http://192.168.56.10:9200/customer/external/1/_update
request transmission parameters:
{
"doc": {
"name": "John Nash"
}
}
Send request may get the following result, you can see the update was successful:
send a request again, you can see if the same data, compared to the original data, the same as the original would do nothing _version
, _seq_no
will not change:
Use 不
with _update
a post request to update the data, using the post method postman send http://192.168.56.10:9200/customer/external/1
request
parameters above, you can see, each click will be updated data, data validation will not do:
Note that for updates without _update, you can use it when passing parameters
{ "doc": { "name": "John Nash", "age":40 } }
You can also use:
{ "name": "John Nash2", "age": 40 }
reference:
Getting started with the full-text search engine Elasticsearch