通过profile 查看es 是如何对 match query 进行查询的
POST movies/_search
{
"profile": true,
"query": {
"match": {
"title": "one love"
}
}
}
结果如下(省略了部分不必要的信息)
"profile" : {
"shards" : [
{
"id" : "[Q491-N8XRdyUYsCZCLJFFQ][movies][0]",
"searches" : [
{
"query" : [
{
"type" : "BooleanQuery",
"description" : "title:one title:love",
"time_in_nanos" : 1359749
"children" : [
{
"type" : "TermQuery",
"description" : "title:one",
"time_in_nanos" : 288077
},
{
"type" : "TermQuery",
"description" : "title:love",
"time_in_nanos" : 244287
}
]
}
],
"rewrite_time" : 5351,
}
],
"aggregations" : [ ]
}
]
}
可以看到包含 3 个查询
- 查询 one love
- 查询 one
- 查询 love
通过profile 查看es 是如何对 match_phrase query 进行查询的
POST movies/_search
{
"profile": true,
"query": {
"match_phrase": {
"title":{
"query": "one love",
"slop": 1
}
}
}
}
默认 slop 是 0
profile 的 search query 描述如下
"type" : "PhraseQuery",
"description" : """title:"one love"~1""",
"time_in_nanos" : 380069,
"one love"~1 意思是 one love 要一起出现,中间可以夹杂另外 一个 单词。
网友评论