Я пытаюсь отсортировать свой документ на основе поля totalEmployee, где индекс index_db , тип отделов и поле totalEmployee
QueryBuilder qb = QueryBuilders.matchAllQuery();
SearchResponse response = client.prepareSearch("index_db").setTypes("departments")
.addSort(SortBuilders.fieldSort("totalEmployee").order(SortOrder.ASC)).setQuery(qb)
.setSize(100).execute().actionGet();
for(SearchHit hits :response.getHits()) {
System.out.print("id = "+hits.getId());
System.out.println(hits.getSourceAsString());
}
Но я получаю ошибку:
Exception in thread "main" Failed to execute phase [query], all shards failed; shardFailures {[q9B7Qs-DSXWC14pjc5zlNg][index_db][0]: RemoteTransportException[[elasticsearch_node][10.64.216.92:9375][indices:data/read/search[phase/query]]]; nested:
IllegalArgumentException[Fielddata is disabled on text fields by default. Set fielddata=true on [totalEmployee] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory.]; }{[q9B7Qs-DSXWC14pjc5zlNg][index_db][1]: RemoteTransportException[[elasticsearch_node][10.64.216.92:9375][indices:data/read/search[phase/query]]]; nested: IllegalArgumentException[Fielddata is disabled on text fields by default. Set fielddata=true on [totalEmployee] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory.]; }{[q9B7Qs-DSXWC14pjc5zlNg][piyush_db][2]: RemoteTransportException[[elasticsearch_node][10.64.216.92:9375][indices:data/read/search[phase/query]]]; nested: IllegalArgumentException[Fielddata is disabled on text fields by default. Set fielddata=true on [totalEmployee] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory.]; }{[q9B7Qs-DSXWC14pjc5zlNg][piyush_db][3]: RemoteTransportException[[elasticsearch_node][10.64.216.92:9375][indices:data/read/search[phase/query]]]; nested: IllegalArgumentException[Fielddata is disabled on text fields by default. Set fielddata=true on [totalEmployee] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory.]; }{[q9B7Qs-DSXWC14pjc5zlNg][piyush_db][4]: RemoteTransportException[[elasticsearch_node][10.64.216.92:9375][indices:data/read/search[phase/query]]]; nested: IllegalArgumentException[Fielddata is disabled on text fields by default. Set fielddata=true on [totalEmployee] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory.]; }