- 基本查询
GET test_employee/_search{
"profile": "true",
返回查询过程"from": 0,
"size": 20,
"_source": ["name","age"],
查询返回的字段"sort": [ { "age": { "order": "desc" } } ],
排序"query": { "match_all": {} },
查询全部"script_fields": {
脚本字段"nicheng": {
"script": {
"lang": "painless",
"source": "'年龄' + doc['age']"
}
}
}
}
- Match
GET test_employee/_search{ "query": { "match": { "name": "张 李" } }}
GET test_employee/_search{ "query": { "match": {
"name": { "query": "晶晶 朱", "operator": "or" } } }}
- Math Phrase
GET test_employee/_search{
"query": {
"match_phrase": {
"name":{
`<br />
“query”: “朱2”, <br />
“slop”: 2 `中间可以插入几个数量的term
}
} }}
- query string / simple query string
GET test_employee/_search{ "query": { "query_string": { "fields": ["name","country"], "query": "中 AND 李" } }}