#Display the status of each shard GET /_cat/shards?v #Display the
cluster health value
GET /_cluster/health #New
index
PUT /test_index?pretty #Query
all indexes
GET /_cat/indices?v #Delete
index
DELETE /test_index? Pretty
# Sort
GET / Product / _search the Sort =. price:? desc
# keyword query + sort
? GET / Product / _search q = name: Phone & the Sort =. price: desc
# query id data 1
GET / Product / _doc / 1
# Paging query, sorting, timeout setting, after the time arrives, how much data is displayed, how much data is displayed
GET /product/_search?from=0&size=2&sort=price:desc&timeout=1ms #Query
all
GET /product/_search
{ "query" : { "match_all": {} } } #sort query GET /product/_search {
"query": { "match": { "name": "nfc" } }, "sort": [ { "price": { "order": "desc" } } ] } #在多个字段中查询关键词 GET /product/_search { "query": { "multi_match": { "query": "nfc", "fields": ["name","desc"] } }, "sort": [ { "price": { "order": "desc"#Query to display specific fields} "size": 2 "from": 1, ], } }
GET /product/_search
{ "query": { "match": { "name": "nfc phone" } }, "sort": [ { "price": "desc" } ], "_source": ["name ","price"] } #term does not support automatic word segmentation of query keywords. It also explains that es query is based on word segmentation GET /product/_search { "query": { "term": { "name": "nfc phone" } } } GET /product/_search { "query": { "bool": { "must": [ { "term": { "name":"nfc"
}
},
{ "term": { "name": { "value": "phone" } } } ] } } } #terms multi-keyword query, similar to in, equivalent to artificial word segmentation GET /product/_search { "query": { "terms": { "name": [ "nfc", "phone" ] } } } GET /product/_search { "query": { "match": { "name": "nfc phone" } } }
#match会进行分词查询
GET /product/_search
{
"query": {
"match": {
"name": "xiaomi nfc zhineng phone"
}
}
}
#默认分词器
GET /_analyze
{
"analyzer": "standard",
"text": ["xiaomi nfc zhineng phone"]
}
PUT /product/_doc/1
{
"name" : "xiaomi phone",
"desc" : "shouji zhong de zhandouji",
"price" : 3999,
"tags": [ "xingjiabi", "fashao", "buka" ]
}
POST /product/_doc/1/_update
{
"doc":{
"price":2999
}
}
PUT /product/_doc/2
{
"name" : "xiaomi nfc phone",
"desc" : "zhichi quangongneng nfc,shouji zhong de jianjiji",
"price" : 4999,
"tags": [ "xingjiabi", "fashao", "gongjiaoka" ]
}
PUT /product/_doc/3
{
"name" : "nfc phone",
"desc" : "shouji zhong de hongzhaji",
"price" : 2999,
"tags": [ "xingjiabi", "fashao", "menjinka" ]
}
PUT /product/_doc/4
{
"name" : "xiaomi erji",
"desc" : "erji zhong de huangmenji",
"price" : 999,
"tags": [ "low", "bufangshui", "yinzhicha" ]
}
PUT /product/_doc/5
{
"name" : "hongmi erji",
"desc" : "erji zhong de kendeji nfc",
"price" : 399,
"tags": [ "lowbee", "xuhangduan", "zhiliangx" ]
}