目录
多索引联合搜索
//单个索引搜索
GET /twitter/_search?q=user:kimchy
//两个索引搜索
GET /kimchy,elasticsearch/_search?q=tag:wow
//搜索集群内索引索引
GET /_all/_search?q=tag:wow
script
查询
{
"query": {
"bool": {
"must": [
{
"term":{
"tags": "shield"
}
},
{
"term":{
"tags": "netsuper"
}
}
]
}
},
"script_fields": {
"test": {
"script": {
"lang": "painless",
"source": "doc['layer'].value*100"
}
}
}
}
结果
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 10759,
"max_score": 1.5365356,
"hits": [
{
"_index": "back_items-20190301",
"_type": "_doc",
"_id": "17794230",
"_score": 1.5365356,
"fields": {
"test": [
11100
]
}
}
]
}
}