【问题标题】:can ElasticSearch only add field index ,no save the orignal value just like lucene Field.Store.NOElasticSearch可以只添加字段索引,不保存原始值,就像lucene Field.Store.NO
【发布时间】:2020-04-07 16:33:27
【问题描述】:

我在 MySQL 中有一个很大的字段,不想将原始值保存到 ElasticSearch。有没有像 Lucene Field.Store.NO 这样的方法? 谢谢。

【问题讨论】:

    标签: elasticsearch indexing lucene store


    【解决方案1】:

    您只需要相应地定义“store”映射,例如。 :

    PUT your-index
    {
      "mappings": {
        "properties": {
          "some_field": {
            "type": "text",
            "index": true,
            "store": false
          }
        }
      }
    }
    

    您可能还想禁用 _source 字段:

    #disable-source-field
    _source 字段包含在索引时传递的原始 JSON 文档正文 [...] 虽然很方便,但 source 字段确实会在索引中产生存储开销。

    因此,可以按如下方式禁用:

    PUT your-index
    {
      "mappings": {
       "_source": {
          "enabled": false
        }
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2011-02-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多