Elasticsearch(ES)API 增删查改常用操作
常用操作
查询所有数据
POST http://192.168.97.173:27009/logstash_test_2018/doc/_search
{ "query": { "bool": { "must": [ { "match_all": { } } ], "must_not": [ ], "should": [ ] } }, "from": 0, "size": 20, "sort": [ ], "aggs": { } }
根据条件查询
POST http://192.168.97.173:27009/logstash_tower-lihang_2018/doc/_search
{ "query": { "bool": { "must": [ { "wildcard": { "weight.keyword": "互*网" } } ], "must_not": [ ], "should": [ ] } }, "from": 0, "size": 10, "sort": [ ], "aggs": { } }
更新数据
PUT http://192.168.97.173:27009/logstash_tower-lihang_2018/doc/cqXKaWQBCaAmlugIjMEd(这是ID)
{ "windSpeed": "0" }
根据id删除数据
POST http://192.168.97.173:27009/logstash_tower-lihang_2018/doc/_delete_by_query
{ "query": { "match": { "_id": "VqZhd2QBCaAmlugIeMZQ" } } }
根据某字段排序
POST http://192.168.97.173:27009/logstash_tower-lihang_2018/doc/_search
{ "query": { "bool": { "must": [ { "wildcard": { "weight.keyword": "互*网" } } ], "must_not": [ ], "should": [ ] } }, "from": 0, "size": 10, "sort": {"dateTime":{"order": "desc"}}, "aggs": { } }
技术微信群:
加微信:wonter 发送:技术Q
医疗微信群:
加微信:wonter 发送:医疗Q
更多文章关注公众号:
加微信:wonter 发送:技术Q
医疗微信群:
加微信:wonter 发送:医疗Q
更多文章关注公众号:
![](https://images.cnblogs.com/cnblogs_com/Javame/604499/o_cto.png)