加载前30标签和前12名用户报错
来源:21-2 -后台实现_0
罐头瓶丶AA
2018-10-12
java.lang.IllegalArgumentException: Fielddata is disabled on text fields by default. Set fielddata=true on [tag] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.
at org.elasticsearch.index.mapper.TextFieldMapper$TextFieldType.fielddataBuilder(TextFieldMapper.java:670) ~[elasticsearch-5.6.11.jar:5.6.11]
at org.elasticsearch.index.fielddata.IndexFieldDataService.getForField(IndexFieldDataService.java:115) ~[elasticsearch-5.6.11.jar:5.6.11]
at org.elasticsearch.index.query.QueryShardContext.getForField(QueryShardContext.java:166) ~[elasticsearch-5.6.11.jar:5.6.11]
at org.elasticsearch.search.aggregations.support.ValuesSourceConfig.resolve(ValuesSourceConfig.java:94) ~[elasticsearch-5.6.11.jar:5.6.11]
at org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder.resolveConfig(ValuesSourceAggregationBuilder.java:317) ~[elasticsearch-5.6.11.jar:5.6.11]
at org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder.doBuild(ValuesSourceAggregationBuilder.java:310) ~[elasticsearch-5.6.11.jar:5.6.11]
at org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder.doBuild(ValuesSourceAggregationBuilder.java:37) ~[elasticsearch-5.6.11.jar:5.6.11]
at org.elasticsearch.search.aggregations.AbstractAggregationBuilder.build(AbstractAggregationBuilder.java:139) ~[elasticsearch-5.6.11.jar:5.6.11]
at org.elasticsearch.search.aggregations.AggregatorFactories$Builder.build(AggregatorFactories.java:329) ~[elasticsearch-5.6.11.jar:5.6.11]
at org.elasticsearch.search.SearchService.parseSource(SearchService.java:766) ~[elasticsearch-5.6.11.jar:5.6.11]
at org.elasticsearch.search.SearchService.createContext(SearchService.java:575) ~[elasticsearch-5.6.11.jar:5.6.11]
at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:551) ~[elasticsearch-5.6.11.jar:5.6.11]
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:347) ~[elasticsearch-5.6.11.jar:5.6.11]
at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:333) ~[na:na]
at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:329) ~[na:na]
at org.elasticsearch.search.SearchService$3.doRun(SearchService.java:1019) ~[na:na]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:723) ~[elasticsearch-5.6.11.jar:5.6.11]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-5.6.11.jar:5.6.11]
at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:41) ~[na:na]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) ~[elasticsearch-5.6.11.jar:5.6.11]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_161]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_161]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_161]
SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(QueryBuilders.matchAllQuery())
.withSearchType(SearchType.QUERY_THEN_FETCH)
.withIndices(“blog”).withTypes(“blog”)
.addAggregation(AggregationBuilders.terms(“tag”).field(“tag”)
.order(Terms.Order.count(false)).size(30)).build();
老师,这里的聚合【AggregationBuilders.terms(“tag”).field(“tag”)】里面的"tag"字符串对应的哪里的tag?
1回答
-
老卫
2018-10-12
elasticsearch 版本与你使用的 Spring Boot 版本不匹配吧? 见我手记上关于版本的说明
022018-10-14
基于Spring Boot技术栈博客系统企业级前后端实战
1296 学习 · 738 问题
相似问题