为ElasticSearch配置分析 [英] Configure analysis for ElasticSearch

查看:75
本文介绍了为ElasticSearch配置分析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试配置ElasticSearch:

i try configure ElasticSearch :

fos_elastica:
indexes:
    test:
        settings:
            index:
               analysis:
                   analyzer:
                       autocomplete:
                           type: custom
                           tokenizer: lowercase
                           filter   : [my_ngram]
               filter:
                   my_ngram:
                   type: "nGram"
                   min_gram: 2
                   max_gram: 20
        types:
            Track:
                mappings: 
                    title: { analyzer: autocomplete }
                    artist: { analyzer: autocomplete }
                persistence:
                    driver: orm
                    model:  Website\TestBundle\Entity\Track
                    provider: ~
                    listener: ~
                    finder: ~

当我执行" http://mydomain时,这是我的错误.com:9200/test/_analyze?analyzer = autocomplete& text = rih "

{"error":"ElasticSearchIllegalArgumentException[failed to find analyzer [autocomplete]]","status":400}

出什么问题了?谢谢

推荐答案

错误显示无法找到分析器[自动完成]".在Elasticsearch中,默认情况下您可以使用多个分析器.尽管您可以创建一个自定义分析器,但我不知道默认情况下是否有任何自动完成分析器,这可能是您要解决的问题.

The error says "failed to find analyzer [autocomplete]". In Elasticsearch you have several analyzers to your disposal by defaults. I am not aware of any autocomplete analyzer available by default, although you can create a custom analyzer and that could be the problem you're trying to solve.

如果您正在寻找自动完成功能,请随时查看Elasticsearch网站上的完成建议程序文档或有关快速而肮脏的完成建议程序的Sloan Ahrens教程
此处: http://blog.qbox.io/quick并建议弹性搜索完成自动完成

If you're looking for autocomplete feel free to checkout the completion suggester documentation on the elasticsearch site or Sloan Ahrens tutorial on quick and dirty completion suggester
here:http://blog.qbox.io/quick-and-dirty-autocomplete-with-elasticsearch-completion-suggest

如果您正在寻找更高级的技术,斯隆·阿伦斯(Sloan Ahrens)提供了很棒的教程

If you're looking for more advanced techniques Sloan Ahrens has a great tutorial

此处: http://blog.qbox.io/multi-field-partial-word-autocomplete-in-elasticsearch-using-ngrams

我会提供指向我所引用的所有文档的所有文档链接,但不幸的是,我没有这样做的声誉.

I would provide all the documentation links to everything I am referencing but unfortunately I don't have the reputation points it takes to do so.

这篇关于为ElasticSearch配置分析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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