uri search
# 根據code字段查
GET /inventory2/_search?q=code:0052
# 多個index查找
GET /inventory1,inventory2/_search?q=code:0052
# 全部index查找
GET /_all/_search?q=tag:wow
request body search
GET /inventory1/_search
{
"query" : {
"term" : { "code" : "0052" }
}
}
GET /inventory1/_search
{
"query" : {
"match" : { "code" : "0052" }
}
}
# from size 分頁用
GET /inventory1,inventory2/_search
{
"from":1,"size":2,
"query" : {
"term" : { "code" : "0052" }
}
}
# highlight
GET /inventory1/_search
{
"query" : {
"match" : { "code" : "0052" }
},
"highlight" : {
"fields" : {
"code" : {}
}
}
}
# highlight 指定標籤
GET /inventory1/_search
{
"query" : {
"match": { "code" : "0052" }
},
"highlight" : {
"pre_tags" : ["<tag1>"],
"post_tags" : ["</tag1>"],
"fields" : {
"code" : {}
}
}
}