I understand that this is a new change, but I can't see what's wrong with this mapping. This is taken from the mapping of the field registered in ElasticSearch through _mapping call:
"key": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
When I sort using the "key" field, I get this exception. I have also tried adding fieldData=true, but that also didn't work.
Caused by: RemoteTransportException[[_6qwpaI][127.0.0.1:9300][indices:data/read/search[phase/query]]]; nested: IllegalArgumentException[Fielddata is disabled on text fields by default. Set fielddata=true on [key] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory.];
Caused by: java.lang.IllegalArgumentException: Fielddata is disabled on text fields by default. Set fielddata=true on [key] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory.
at org.elasticsearch.index.mapper.TextFieldMapper$TextFieldType.fielddataBuilder(TextFieldMapper.java:335)
at org.elasticsearch.index.fielddata.IndexFieldDataService.getForField(IndexFieldDataService.java:111)
at org.elasticsearch.index.query.QueryShardContext.getForField(QueryShardContext.java:167)
at org.elasticsearch.search.sort.FieldSortBuilder.build(FieldSortBuilder.java:281)
at org.elasticsearch.search.sort.SortBuilder.buildSort(SortBuilder.java:151)
at org.elasticsearch.search.SearchService.parseSource(SearchService.java:678)
at org.elasticsearch.search.SearchService.createContext(SearchService.java:536)
at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:502)
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:243)
at org.elasticsearch.action.search.SearchTransportService.lambda$registerRequestHandler$6(SearchTransportService.java:276)
at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33)
at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69)
at org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:550)
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:527)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
At first I thought this might be related to the use of a field (e.g. key.keyword), but since I'm not doing that, then I don't see any reason why this is not working.
I'm pretty new to ElasticSearch 5.x and the document is contradicting itself so I hope someone can point me to the right direction. This is what I referring to:
https://www.elastic.co/guide/en/elasticsearch/reference/current/fielddata.html
I'm essentially trying to achieve the same as this original mapping that was working until 5.x:
"mapping": {
"type": "string",
"fields": {
"raw": {
"type": "string",
"ignore_above": 256
},
"english": {
"type": "string",
"analyzer": "english"
}
}
}