ElasticSearch 在排序操作时报错: Fielddata is disabled on text fields by default...

  1. 异常信息:
    Fielddata is disabled on text fields by default. Set fielddata=true on [my_field] 
    in order to load fielddata in memory by uninverting the inverted index. 
    Note that this can however use significant memory. Alternatively use a keyword field instead.
    
  2. 解决办法:

    默认情况下 text 字段的 Fielddata 是禁用的。如果对 text 字段中的进行排序,汇总或访问值,则会看到上述异常。
    可以对 text 字段上启用 Fielddata 解决。

    curl -X PUT "localhost:9200/my_index/_mapping?pretty" -H 'Content-Type: application/json' -d'
    {
      "properties": {
        "my_field": { 
          "type":     "text",
          "fielddata": true
        }
      }
    }
    '
    

参考: https://www.elastic.co/guide/en/elasticsearch/reference/current/fielddata.html

你可能感兴趣的:(ElasticSearch 在排序操作时报错: Fielddata is disabled on text fields by default...)