【问题标题】:How do I make the field searchable?如何使字段可搜索?
【发布时间】:2019-02-23 02:28:50
【问题描述】:

我有弹性搜索索引,其中存储了数据。我想使用某些字段进行查询。问题是某些字段不可搜索。以下是有关映射结构的一些信息:

"bdate": {
    "type": "string",
    "store": true
    },
"c": {
    "type": "string",
    "index": "no",
    "store": true
}

我明白,由于"index":"no" 附加到"c" 字段,我无法使用该字段编写查询。但是我应该如何将"index""no" 更改为另一个值才能编写所需的查询?

我的 Elasticsearch 版本是 1.5。

【问题讨论】:

    标签: elasticsearch


    【解决方案1】:

    您必须更改映射。您不能更改现有字段的映射。

    你需要重新索引你的索引,这样做: 1)新建索引(空) 2) 在这个新索引上创建新的映射 3)将您的数据从现有索引重新索引到新索引。你可以使用:

    POST _reindex
    {
      "source": {
        "remote": {
          "host": "an url if your are not on the same server, if you use the same one on localhost for example: http://localhost:9200"
        },
        "index": "oldindex"
      },
      "dest": {
        "index": "newindex"
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-06-14
      • 2013-05-15
      • 2017-10-12
      • 1970-01-01
      • 2017-01-29
      • 2012-01-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多