如何在 ElasticSearch 中不进行分析? [英] How to not-analyze in ElasticSearch?

查看:50
本文介绍了如何在 ElasticSearch 中不进行分析?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不想分析 ElasticSearch 字段中的一个字段,即.e.它应该被逐字存储和比较.这些值将包含字母、数字、空格、破折号、斜线和其他字符.

I've got a field in an ElasticSearch field which I do not want to have analyzed, i. e. it should be stored and compared verbatim. The values will contain letters, numbers, whitespace, dashes, slashes and maybe other characters.

如果我没有在我的这个字段的映射中提供一个分析器,默认情况下仍然使用一个标记器,它将我的逐字字符串破解成词块.我不想那样.

If I do not give an analyzer in my mapping for this field, the default still uses a tokenizer which hacks my verbatim string into chunks of words. I don't want that.

有没有一个超级简单的分析器,基本上不分析?或者有什么不同的方式来表示这个字段不应该被分析?

Is there a super simple analyzer which, basically, does not analyze? Or is there a different way of denoting that this field shall not be analyzed?

我只创建索引,我不做任何其他事情.我可以将像english"这样的分析器用于其他字段,这些字段似乎是预配置分析器的内置名称.有其他名字的列表吗?也许有一个适合我的需求(即对输入不做任何处理).

I only create the index, I don't do anything else. I can use analyzers like "english" for other fields which seems to be built-in names for pre-configured analyzers. Is there a list of other names? Maybe there's one fitting my needs (namely doing nothing with the input).

这是我目前的映射:

{
  "my_type": {
    "properties": {
      "my_field1": { "type": "string", "analyzer": "english" },
      "my_field2": { "type": "string" }
    }
  }
}

my_field1 依赖于语言;这似乎有效.my_field2 应逐字逐句.我想在那里提供一个分析器,它根本不做任何事情.

my_field1 is language-dependent; this seems to work. my_field2 shall be verbatim. I'd like to give an analyzer there which simply does not do anything.

my_field2 的示例值为 "B45c 14/04".

推荐答案

"my_field2": {
    "properties": {
        "title": {
            "type": "string",
            "index": "not_analyzed"
        }
    }
}

在这里查看,https://www.elastic.co/guide/en/elasticsearch/reference/1.4/mapping-core-types.html,了解更多信息.

Check you here, https://www.elastic.co/guide/en/elasticsearch/reference/1.4/mapping-core-types.html, for further info.

这篇关于如何在 ElasticSearch 中不进行分析?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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