gpt4 book ai didi

elasticsearch - 对动态字段禁用分析器

转载 作者:行者123 更新时间:2023-12-03 02:03:44 24 4
gpt4 key购买 nike

在我的 Elasticsearch 索引中,我为特定对象启用了动态映射,这意味着默认情况下将分析添加到该对象的所有“字符串”字段。

有没有办法禁用对动态字段的分析?

最佳答案

您将要使用与字符串字段匹配的“动态模板”,并应用将字段设置为“not_analyzed”的映射

http://www.elastic.co/guide/en/elasticsearch/guide/current/custom-dynamic-mapping.html

这是一个使分析和未分析均可用的示例

'dynamic_templates' : [
{
'string_template' : {
'match' : '*',
'match_mapping_type' : 'string',
'mapping' : {
'type' : 'multi_field',
'fields': {
'{name}' : {'type': 'string', 'index': 'analyzed', 'analyzer' : 'default'},
'raw': { 'type': 'string', 'index': 'not_analyzed'}"
}
}
}
}
]

关于elasticsearch - 对动态字段禁用分析器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29021958/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com