简体   繁体   English

ElasticSearch-筛选条件以实现自动完成

[英]ElasticSearch - filter terms for autocomplete

I would like for an autocomplete to get the terms starting with some specific characters.However, the terms returned do not begin with the specified text ("wer" in this case), and more than that, no matter what the prefix content is, they are always the same. 我想让自动填充功能以某些特定字符开头的字词。但是,返回的字词不是以指定的文本开头(在这种情况下为“ wer”),更重要的是,无论前缀内容是什么,他们总是一样的。 The query I am using now is: 我现在使用的查询是:

  {"facets":
      {"count":
          {"terms":
                {"field":"content"},
                 "facet_filter":
                     {"prefix":{"content":"wer"}}
          }
      },
    "size":0
  }

I am wondering what am I missing or doing wrong. 我想知道我在想什么或做错了什么。 Any help much appreciated. 任何帮助,不胜感激。 Thanks! 谢谢!

Perhaps you miss a "query" entry after the facet_filter. 也许您错过了facet_filter之后的“查询”条目。 If this does not help try regex pattern for facets, but be aware that facets will be removed in future updates of elasticsearch. 如果这没有帮助尝试使用构面的正则表达式模式,但是请注意,将来在Elasticsearch中更新构面将被删除。

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-facets-terms-facet.html#_regex_patterns http://www.elasticsearch.org/guide/zh-CN/elasticsearch/reference/current/search-facets-terms-facet.html#_regex_patterns

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM