2

When I use elasticsearch java api to sort my document, the es has error:

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.

And my code for sorting like this:

SortBuilder sortBuilder = SortBuilders.fieldSort(sortField)
                .order(SortOrder.valueOf(order.toUpperCase()));
SearchRequestBuilder srb1 = client.prepareSearch()
                .setQuery(qb).setIndices(indexName)
                .setTypes(type).addSort(sortBuilder);

I want to know how to set fielddata=true by java api.

1
  • Please check this answer: Link Commented Dec 19, 2017 at 10:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.