【发布时间】:2015-02-13 01:55:31
【问题描述】:
我在弹性搜索中存储了一些文档,包含 2 列:
id | data
--- -----
(int) json string
我使用什么映射来要求弹性搜索只存储 json 字符串而不对其进行任何处理?为了提高效率,我不希望该列被索引或可搜索 - 只希望 ES 将其存储为位。
【问题讨论】:
标签: java json database elasticsearch
我在弹性搜索中存储了一些文档,包含 2 列:
id | data
--- -----
(int) json string
我使用什么映射来要求弹性搜索只存储 json 字符串而不对其进行任何处理?为了提高效率,我不希望该列被索引或可搜索 - 只希望 ES 将其存储为位。
【问题讨论】:
标签: java json database elasticsearch
在该字段的映射中使用"index": "no"。
所以可能是这样的:
PUT /test_index
{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1
},
"mappings": {
"doc": {
"properties": {
"id": {
"type": "integer"
},
"json_string": {
"type": "string",
"index": "no"
}
}
}
}
}
【讨论】: