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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章