错误描述:
Caused by: java.lang.IllegalArgumentException: Fielddata is disabled on text fields by default. Set fielddata=true on [orderCode] 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:336)
at org.elasticsearch.index.fielddata.IndexFieldDataService.getForField(IndexFieldDataService.java:111)
at org.elasticsearch.index.query.QueryShardContext.getForField(QueryShardContext.java:165)
at org.elasticsearch.search.sort.FieldSortBuilder.build(FieldSortBuilder.java:277)
at org.elasticsearch.search.sort.SortBuilder.buildSort(SortBuilder.java:156)
at org.elasticsearch.search.SearchService.parseSource(SearchService.java:688)
at org.elasticsearch.search.SearchService.createContext(SearchService.java:540)
at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:516)
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:251)
at org.elasticsearch.action.search.SearchTransportService$6.messageReceived(SearchTransportService.java:298)
at org.elasticsearch.action.search.SearchTransportService$6.messageReceived(SearchTransportService.java:295)
at org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor$ProfileSecuredRequestHandler$1.doRun(SecurityServerTransportInterceptor.java:237)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at org.elasticsearch.common.util.concurrent.EsExecutors$1.execute(EsExecutors.java:109)
at org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor$ProfileSecuredRequestHandler.lambda$messageReceived$0(SecurityServerTransportInterceptor.java:289)
at org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor$ProfileSecuredRequestHandler$$Lambda$1538/2013783967.accept(Unknown Source)
at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:56)
at org.elasticsearch.xpack.security.transport.ServerTransportFilter$NodeProfile.lambda$null$2(ServerTransportFilter.java:164)
at org.elasticsearch.xpack.security.transport.ServerTransportFilter$NodeProfile$$Lambda$1546/895003706.accept(Unknown Source)
at org.elasticsearch.xpack.security.authz.AuthorizationUtils$AsyncAuthorizer.maybeRun(AuthorizationUtils.java:127)
at org.elasticsearch.xpack.security.authz.AuthorizationUtils$AsyncAuthorizer.setRunAsRoles(AuthorizationUtils.java:121)
at org.elasticsearch.xpack.security.authz.AuthorizationUtils$AsyncAuthorizer.authorize(AuthorizationUtils.java:109)
at org.elasticsearch.xpack.security.transport.ServerTransportFilter$NodeProfile.lambda$inbound$3(ServerTransportFilter.java:166)
at org.elasticsearch.xpack.security.transport.ServerTransportFilter$NodeProfile$$Lambda$1540/1721144311.accept(Unknown Source)
at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:56)
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$authenticateAsync$0(AuthenticationService.java:182)
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator$$Lambda$1542/1882373383.accept(Unknown Source)
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$lookForExistingAuthentication$2(AuthenticationService.java:201)
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator$$Lambda$1543/1075989798.run(Unknown Source)
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lookForExistingAuthentication(AuthenticationService.java:213)
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.authenticateAsync(AuthenticationService.java:180)
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.access$000(AuthenticationService.java:142)
at org.elasticsearch.xpack.security.authc.AuthenticationService.authenticate(AuthenticationService.java:114)
at org.elasticsearch.xpack.security.transport.ServerTransportFilter$NodeProfile.inbound(ServerTransportFilter.java:142)
at org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor$ProfileSecuredRequestHandler.messageReceived(SecurityServerTransportInterceptor.java:296)
at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69)
at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:610)
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:596)
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)
Caused by: java.lang.IllegalArgumentException: Fielddata is disabled on text fields by default. Set fielddata=true on [orderCode] 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:336)
at org.elasticsearch.index.fielddata.IndexFieldDataService.getForField(IndexFieldDataService.java:111)
at org.elasticsearch.index.query.QueryShardContext.getForField(QueryShardContext.java:165)
at org.elasticsearch.search.sort.FieldSortBuilder.build(FieldSortBuilder.java:277)
at org.elasticsearch.search.sort.SortBuilder.buildSort(SortBuilder.java:156)
at org.elasticsearch.search.SearchService.parseSource(SearchService.java:688)
at org.elasticsearch.search.SearchService.createContext(SearchService.java:540)
at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:516)
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:251)
at org.elasticsearch.action.search.SearchTransportService$6.messageReceived(SearchTransportService.java:298)
at org.elasticsearch.action.search.SearchTransportService$6.messageReceived(SearchTransportService.java:295)
at org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor$ProfileSecuredRequestHandler$1.doRun(SecurityServerTransportInterceptor.java:237)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at org.elasticsearch.common.util.concurrent.EsExecutors$1.execute(EsExecutors.java:109)
at org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor$ProfileSecuredRequestHandler.lambda$messageReceived$0(SecurityServerTransportInterceptor.java:289)
at org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor$ProfileSecuredRequestHandler$$Lambda$1538/2013783967.accept(Unknown Source)
at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:56)
at org.elasticsearch.xpack.security.transport.ServerTransportFilter$NodeProfile.lambda$null$2(ServerTransportFilter.java:164)
at org.elasticsearch.xpack.security.transport.ServerTransportFilter$NodeProfile$$Lambda$1546/895003706.accept(Unknown Source)
at org.elasticsearch.xpack.security.authz.AuthorizationUtils$AsyncAuthorizer.maybeRun(AuthorizationUtils.java:127)
at org.elasticsearch.xpack.security.authz.AuthorizationUtils$AsyncAuthorizer.setRunAsRoles(AuthorizationUtils.java:121)
at org.elasticsearch.xpack.security.authz.AuthorizationUtils$AsyncAuthorizer.authorize(AuthorizationUtils.java:109)
at org.elasticsearch.xpack.security.transport.ServerTransportFilter$NodeProfile.lambda$inbound$3(ServerTransportFilter.java:166)
at org.elasticsearch.xpack.security.transport.ServerTransportFilter$NodeProfile$$Lambda$1540/1721144311.accept(Unknown Source)
at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:56)
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$authenticateAsync$0(AuthenticationService.java:182)
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator$$Lambda$1542/1882373383.accept(Unknown Source)
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lambda$lookForExistingAuthentication$2(AuthenticationService.java:201)
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator$$Lambda$1543/1075989798.run(Unknown Source)
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.lookForExistingAuthentication(AuthenticationService.java:213)
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.authenticateAsync(AuthenticationService.java:180)
at org.elasticsearch.xpack.security.authc.AuthenticationService$Authenticator.access$000(AuthenticationService.java:142)
at org.elasticsearch.xpack.security.authc.AuthenticationService.authenticate(AuthenticationService.java:114)
at org.elasticsearch.xpack.security.transport.ServerTransportFilter$NodeProfile.inbound(ServerTransportFilter.java:142)
at org.elasticsearch.xpack.security.transport.SecurityServerTransportInterceptor$ProfileSecuredRequestHandler.messageReceived(SecurityServerTransportInterceptor.java:296)
at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69)
at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:610)
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:596)
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)
2 个回复
kennywu76 - Wood
赞同来自: mn_1127
如果一定有对该字段按照文本字母序做排序的需求,可以将该字段定义为multi-filed,例如:
上面的city是text类型,适合做全文搜索,然后排序的时候可以用其keyword类型即city.raw。 这样排序结果是正确的,并且keyword字段是通过doc values排序的,内存消耗远小于fielddata。
yuan327159409 - 90后开发
赞同来自: