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.
阿新 • • 發佈:2020-12-10
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
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
}
}
}