英文:
ElasticSearch: how can I check the way multiple analyzers split a text into tokens?
问题
我对ElasticSearch还比较新,所以如果我忽视了一些明显/基本的东西,请原谅。
我正在使用ElasticSearch,并想查看应用于索引的分析器是如何将文本拆分成标记的。根据GET /my_index/_settings
的结果显示,多个分析器被应用于索引,如下所示:
{
"my_index": {
"settings": {
"analysis": {
"analyzer": {
"my_ngram_search_analyzer": {},
"my_ngram_index_analyzer": {},
"my_kuromoji_search_analyzer": {},
"my_kuromoji_index_analyzer": {},
}
}
}
}
}
因此,我尝试使用数组来分析文本,但它不起作用。
GET /my_index/_analyze
{
"text":"本日は晴天なり",
"analyzer":["my_ngram_search_analyzer","my_kuromoji_search_analyzer"]
}
我该如何执行此操作?如果您能分享一些信息,我将不胜感激。
英文:
I'm quite new to ElasticSearch, so if I overlook something obvious/basic, please forgive me.
I'm using ElasticSearch and want to see how analyzers applied to an index split a text into tokens. And as far as the result of GET /my_index/_settings
displays, multiple analyzers are applied to the index, like following:
{
"my_index": {
"settings": {
"analysis": {
"analyzer": {
"my_ngram_search_analyzer": {},
"my_ngram_index_analyzer": {},
"my_kuromoji_search_analyzer": {},
"my_kuromoji_index_analyzer": {},
}
}
}
}
}
So I tried to analyze a text with multiple analyzers using an array, but it does not work.
GET /my_index/_analyze
{
"text":"本日は晴天なり",
"analyzer":["my_ngram_search_analyzer","my_kuromoji_search_analyzer"]
}
How can I perform this?
I'd appreciate it if you would share some information.
答案1
得分: 1
Analyze API 不支持使用多个分析器分析文本,它只能使用一个分析器。在索引中,您可以定义多个分析器,可以应用于Elasticsearch索引中的各个字段。
您还不能将多个索引时间或搜索时间的分析器应用于单个字段。
希望这能帮助您。
英文:
Analyze API doesn't support analysing a text with multiple analyzers and it works with just one analyzer, In the index you can define many analyzers which can be applied to various fields in Elasticsearch index.
You can also not apply multiple index time or search time analysers to a single field in Elasticsearch.
Hope this helps.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论