Fielddata is disabled on text fields by default. Set fielddata=true on [XXX] in order to load fielddata in memory by uninverting the inverted index.


1、報錯信息:

Fielddata is disabled on text fields by default. Set fielddata=true on [createTime] 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、翻譯如下:

默認情況下在文本字段中禁用 Fielddata。在字段 [createTime] 上設置 fielddata=true,以便通過不反轉反轉索引將 fielddata 加載到內存中。注意,這可能會使用大量內存,或者使用關鍵字 [keyWord] 字段代替。

3、報錯原因:

ElasticSearch 5.x 版本之后將 String 類型去掉了,以 text 和 keyWord 代替。

官方解釋如下:https://www.elastic.co/guide/en/elasticsearch/reference/current/fielddata.html

4、如何解決:

PUT 你的index/_mapping/你的type/
{
  "properties": {
    "你的字段": { 
      "type":     "text或keyWord",
      "fielddata"true
    }
  }
}

修改報錯中提到的字段類型,修改為 text 或 keyWord。以 createTime 字段為例:

PUT 我的index/_mapping/我的type/
{
  "properties": {
    "createTime": { 
      "type":     "text",
      "fielddata"true
    }
  }
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM