Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
<img src="//i.stack.imgur.com/RUiNP.png" height="16" width="18" alt="" class="sponsor tag img">elasticsearch Elasticsearch:具有多个搜索词的多匹配短语前缀查询_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch - Fatal编程技术网 elasticsearch Elasticsearch:具有多个搜索词的多匹配短语前缀查询,elasticsearch,elasticsearch" /> elasticsearch Elasticsearch:具有多个搜索词的多匹配短语前缀查询,elasticsearch,elasticsearch" />

elasticsearch Elasticsearch:具有多个搜索词的多匹配短语前缀查询

elasticsearch Elasticsearch:具有多个搜索词的多匹配短语前缀查询,elasticsearch,elasticsearch,我有一个数据库,里面有 title: This is my awesome title abstract: A more detailed descriptions of what [...] 我想构建一个与上述文档匹配的Elasticsearch查询,例如 awe detai 换句话说:具有多个搜索词的多匹配短语前缀查询。(这旨在用作键入时的搜索功能。) 我知道如何将多匹配和短语前缀组合在一起,但我不清楚如何对多个搜索词进行组合 有什么提示吗?好吧,没有什么方法可以做到这一点 POST s

我有一个数据库,里面有

title: This is my awesome title
abstract: A more detailed descriptions of what [...]
我想构建一个与上述文档匹配的Elasticsearch查询,例如

awe detai
换句话说:具有多个搜索词的多匹配短语前缀查询。(这旨在用作键入时的搜索功能。)

我知道如何将多匹配和短语前缀组合在一起,但我不清楚如何对多个搜索词进行组合


有什么提示吗?

好吧,没有什么方法可以做到这一点

POST stack/autocomplete/1
{
  "title": "This is my awesome title",
  "abstract": "A more detailed descriptions of what"
}
然后,您可以使用带星号的查询字符串进行搜索,但这里的问题是您需要在查询中附加asterix

POST stack/autocomplete/_search
{
  "query": {
    "query_string": {
      "fields": [
        "title",
        "abstract"
      ],
      "query": "awe* detai*"
    }
  }
}
如果您想在用户查询中匹配,那么可以这样使用

POST stack/autocomplete/_search
{
  "query": {
    "multi_match": {
      "fields": [
        "title",
        "abstract"
      ],
      "query": "awesome tit",
      "type": "phrase_prefix"
    }
  }
}

另一个考虑的选项是使用查询字符串,这样您就不需要修改用户查询“AWE*DETIL*”

您是否尝试使用<代码>术语<代码> >代码>过滤器< /代码>?根据awe detai,您的意思是如果用户键入您想要查找文档?