java es排序_ES问题:JAVA排序时如何设置Fielddata

在使用Java进行Elasticsearch排序时遇到错误:'Fielddata is disabled on text fields by default.' 为了解决这个问题,需要将字段orderCode的fielddata设为true,以加载内存中的fielddata。但要注意这可能消耗大量内存。错误源于TextFieldMapper和IndexFieldDataService,涉及搜索排序和数据加载过程。
摘要由CSDN通过智能技术生成

错误描述:

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)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值