本文主要是介绍Fielddata is disabled on text fields by default. Set fielddata=true on [interests] in order to load,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
按照es官网教程聚合时出现问题,提示非法参数异常如下:
"type": "illegal_argument_exception",
Fielddata is disabled on text fields by default. Set fielddata=true on [interests] 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
默认fielddata在text字段上默认不起作用的,为了能够在内存中解析出倒排索引的字段数据,需要在interes的字段上开启fielddata,
注意如论如何尽量使用有意义的字段,或者是使用其他的字段来代替。
所以需要
PUT megacorp/_mapping/employee/
{
"properties": {
"interests": {
"type": "text",
"fielddata": true
}
}
}
然后执行es教程中的聚合语句
GET /megacorp/employee/_search {"aggs": {"all_interests": {"terms": { "field": "interests" }}} }
这篇关于Fielddata is disabled on text fields by default. Set fielddata=true on [interests] in order to load的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!