【发布时间】:2015-08-18 13:47:47
【问题描述】:
我对 Elasticsearch 很陌生。我需要使用“已分析”和“未分析”索引创建所有字符串字段。我已经能够为 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" } } }
}
}
}
如果有人能帮我解决这个问题,我将不胜感激。谢谢!
【问题讨论】:
标签: python indexing elasticsearch mapping