1. 當根據一個類型爲text的字段idc進行聚合操做時,查詢語句以下:this
{ "aggs": { "top_10_states": { "terms": { "field": "idc" } } } }
會報錯:spa
"Fielddata is disabled on text fields by default. Set fielddata=true on [idc] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory."
解決辦法,在構建查詢語句時,給字段添加.keyword便可解決:code
{ "aggs": { "top_10_states": { "terms": { "field": "idc.keyword" } } } }