我对Elasticsearch很陌生。我需要用“analysed”和“not_analysed”索引创建所有字符串字段。我已经能够为1或2个字段执行此操作,但是如果我的文档中有50个字段,我该怎么做呢?我使用以下代码在一些字段上创建了这样的索引:
mapping = {
"my_type": {
"properties": {
"random_num": {"type": "string"},
"category": { "type":"multi_field", "fields":{ "category":{ "type":"string", "index":"analyzed" },"untouched":{ "type":"string", "index":"not_analyzed" } } },
"url": {"type": "string"},
"id": {"type": "string"},
"desc": { "type":"multi_field", "fields":{ "desc":{ "type":"string", "index":"analyzed" },"untouched":{ "type":"string", "index":"not_analyzed" } } }
}
}
}
如果有人能帮我解决这个问题,我会非常感激的。谢谢!在
您可以浏览文档here。 使用动态索引模板,您可以添加如下规则和acienve相同的规则。 在下面的示例中,我启用了一个名为raw的附加字段,该字段仅在大小小于256的情况下启用,该字段不会被分析。在
相关问题 更多 >
编程相关推荐