如何在没有任何索引的情况下在弹性搜索中存储一些位?

时间:2015-02-13 01:55:32

标签: java json database elasticsearch

我在弹性搜索中存储了一些文档,包含2列:

id     | data
---      -----
(int)    json string

我使用什么映射来请求弹性搜索只存储json字符串而不对其进行任何处理?为了提高效率,我不希望该列被索引或搜索 - 只是希望ES将其存储为位。

1 个答案:

答案 0 :(得分:0)

在该字段的映射中使用"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"
            }
         }
      }
   }
}