弹性搜索短语前缀结果 [英] Elasticsearch phrase prefix results

查看:105
本文介绍了弹性搜索短语前缀结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个ES查询:

  {match:{text:{query:text box,type:短语}}} 
{match:{text:{query:text bo,type:phrase_prefix}}}

问题是第二个查询返回的文档少于第一个查询,尽管我希望第二个查询从第一个查询返回所有记录加上一些额外的内容。我缺少什么?



谢谢

解决方案

max_expansions 被设置为其默认值10



尝试这个



$ $ $ $ $ $$ {
查询:{
match_phrase_prefix:{
text文本bo,
max_expansions:100
}
}
}
}

这个线程将帮助您了解术语的扩展。使 max_expansions 1000并查看结果。



基本上你有很多单词从bo开始,如 ,老板,并且由于'x'是按字母顺序排列的,所以您没有获得预期。



我希望这有帮助!


I have two ES queries:

{match:{text:{query: "text box", type: "phrase"}}}
{match:{text:{query: "text bo", type: "phrase_prefix"}}}

The problem is that the second query returns fewer documents than the first one, although I would expect the second query to return all records from the first one plus something extra. What am I missing?

Thanks

解决方案

This could be due to max_expansions being set to its default value 10

Try this

{
  "query": {
    "match_phrase_prefix": {
      "text": {
        "query": "text bo",
        "max_expansions": 100
      }
    }
  }
}

This thread will help you understand how terms are expanded. make max_expansions 1000 and see the results.

Basically you have lot of words starting with bo like bond, boss and since 'x' comes last alphabetically, you are not getting what you expect.

I hope this helps!

这篇关于弹性搜索短语前缀结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆