全局定义分析器(ES) [英] define analyzer globally (ES)

查看:155
本文介绍了全局定义分析器(ES)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要/想在全球定义我的自定义分析器。因此,我根据这个答案编辑了ES(elasticsearch.yml)的配置文件:我可以自定义弹性搜索以使用我自己的停止词列表吗?相关条目是

  index.analysis.analyzer.angram:
type:custom
tokenizer:standard
filter:standard,lowercase,fngram
index.analysis。 filter.fngram:
类型:nGram
min_gram:2
max_gram:10

但是当我尝试调用 curl -XGET'localhost:9200 / _analyze?analyzer = angram'-d'这是一个测试'我得到一个code> ElasticSearchIllegalARgumentException [找不到分析器[angram]] 。



是配置错误吗? (尽管我希望ES在启动时阅读配置时遇到错误时不会启动)



如何正确地定义全局分析器? / p>

编辑:
我使用的是0.90.0版本

解决方案

问题在于 curl 语句中的URL。信用到Ivan( https://groups.google.com/forum/#!topic/elasticsearch/5XlUoghKURg



我引用了他的答案:


在索引引用之前,您不能使用自定义分析器。您将需要创建使用分析器的映射,然后在分析器调用中使用该索引。没有必要将任何文件索引到该索引。



curl -XGET'localhost:9200 / SOMEINDEX / _analyze?analyzer = angram' / code>



I need/want to define my custom analyzers globally. therefore I edited the configuration file of ES (elasticsearch.yml) according to this answer: Can I customize Elastic Search to use my own Stop Word list? the relevant entries are

index.analysis.analyzer.angram:
  type: custom
  tokenizer: standard
  filter: standard, lowercase, fngram
index.analysis.filter.fngram:
  type: nGram
  min_gram: 2
  max_gram: 10

but when I try to invoke curl -XGET 'localhost:9200/_analyze?analyzer=angram' -d 'this is a test' I get an ElasticSearchIllegalARgumentException[failed to find analyzer [angram]].

is the configuration wrong? (although I'd expect ES to not start-up when encountered an error when reading the configuration during start-up)

how do I correctly define an analyzer globally?

EDIT: I'm using version 0.90.0

解决方案

The problem was with the URL in the curl statement. credit goes to Ivan ( https://groups.google.com/forum/#!topic/elasticsearch/5XlUoghKURg )

I'm quoting his answer from the group:

You cannot use a custom analyzer until it is referenced by an index. You would need to create a mapping that uses the analyzer and then use that index in the analyzer call. There is no need to index any documents to that index.

curl -XGET 'localhost:9200/SOMEINDEX/_analyze?analyzer=angram'

这篇关于全局定义分析器(ES)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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