[ES from entry to actual combat] Seven, full-text search-ElasticSearch-introduction-put&post modify data

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 _updatethe post data update request using the post method postman transmission http://192.168.56.10:9200/customer/external/1/_updaterequest transmission parameters:

{
    
    
     "doc": {
    
    
          "name": "John Nash"
     }
}

Send request may get the following result, you can see the update was successful:
Insert picture description here
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_nowill not change:
Insert picture description here

Use with _updatea post request to update the data, using the post method postman send http://192.168.56.10:9200/customer/external/1request
parameters above, you can see, each click will be updated data, data validation will not do:
Insert picture description here

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:

Elasticsearch Reference

elastic

Getting started with the full-text search engine Elasticsearch

Guess you like

Origin blog.csdn.net/runewbie/article/details/106312141