当我使用elasticsearch java api对我的文档进行排序时,es有错误:
Caused by: java.lang.IllegalArgumentException: Fielddata is disabled on text fields by default. Set fielddata=true on [namespaceName] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory.
我的代码分类如下:
SortBuilder sortBuilder = SortBuilders.fieldSort(sortField)
.order(SortOrder.valueOf(order.toUpperCase()));
SearchRequestBuilder srb1 = client.prepareSearch()
.setQuery(qb).setIndices(indexName)
.setTypes(type).addSort(sortBuilder);
我想知道如何通过java api设置fielddata = true。