简体   繁体   English

ElasticSearch:如何使用REST API定义自定义分析器?

[英]ElasticSearch: how to define custom analyzers with REST API?

I want to define custom analyzers through the REST API (I'm using a hosted service - http://searchbox.io ), but I can't understand how to do it. 我想通过REST API定义自定义分析器(我使用的是托管服务-http://searchbox.io ),但我不知道该怎么做。

I'm trying to create a PUT request to /myindex/_settings with the following: 我正在尝试使用以下命令创建对/ myindex / _settings的PUT请求:

   index: {
            analysis: {
                    analyzer: {
                            "my_analyzer": {
                                    type: "snowball",
                                    language: "English"
                            }
                    }
            }
    }

but it doesn't work, if I index a field with "my_analyzer" set as the analyzer I'm getting an error that it doesn't exist.. 但它不起作用,如果我将设置为“ my_analyzer”的字段索引为分析器,则会收到错误消息,提示它不存在。

I found the answer - those settings must be set when creating the index. 我找到了答案-创建索引时必须设置这些设置。

so a POST request to /myindex did it. 因此对/ myindex的POST请求做到了。

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

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