在Elasticsearch中查找希腊字母及其翻译(α为alpha) [英] Find greek letters with their translation in Elasticsearch (α as alpha)

查看:92
本文介绍了在Elasticsearch中查找希腊字母及其翻译(α为alpha)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须搜索一个包含许多化学和生物学分析符号和术语的索引.它包含许多用于各种分析方法的希腊字母.我想针对以下方面进行优化:

I have to search an index that contains many symbols and terms from chemical and biological analytics. It contains a lot of greek letters for various analytical methods. I would like to optimize for the following things:

    通过搜索 alpha
  • 找到α.
  • 通过搜索
  • 找到 Fe .
  • find α by searching alpha.
  • find Fe by searching iron.

我需要自己创建此映射吗?

Do I need to create this mapping myself?

推荐答案

我会使用

I would use a synonyms token filter to map all the 100+ values you need.

PUT index
{
    "settings" : {
        "analysis" : {
            "analyzer" : {
                "synonyms" : {
                    "tokenizer" : "whitespace",
                    "filter" : ["synonym"]
                }
            },
            "filter" : {
                "synonym" : {
                    "type" : "synonym",
                    "synonyms" : [
                      "α => alpha",
                      "Fe => iron",
                      ...
                    ]
                }
            }
        }
    }
}

请注意,除了内联列出所有同义词以外,您还可以将它们存储在文件中,并使用 synonyms_path 设置指向该文件.

Note that instead of listing all synonyms inline, you can also store them in a file and point to it using the synonyms_path setting.

这篇关于在Elasticsearch中查找希腊字母及其翻译(α为alpha)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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