ElasticSearch排序引起的all shards failed异常原因分析
背景
注:ElasticSearch
版本为5.4
。
在我们的日志系统里需要一些系统索引,这些系统索引在应用初始化的时候就会被添加到ElasticSearch
中去,这些在ElasticSearch
中的系统索引在没有索引数据的时候,只有索引名和一些配置信息,没有mapping
信息。当用户去根据时间区间排序搜索日志信息的时候,ElasticSearch
就会产生all shards failed
异常。具体异常信息如下:
Caused by: [.alert/NXa3zq5WSb-wGBKgyZibzw] QueryShardException[No mapping found for [timestamp] in order to sort on]
at org.ElasticSearch.search.sort.FieldSortBuilder.build(FieldSortBuilder.java:262)
at org.ElasticSearch.search.sort.SortBuilder.buildSort(SortBuilder.java:156)
at org.ElasticSearch.search.SearchService.parseSource(SearchService.java:617)
at org.ElasticSearch.search.SearchService.createContext(SearchService.java:468)
at org.ElasticSearch.search.SearchService.createAndPutContext(SearchService.java:444)
at org.ElasticSearch.search.SearchService.executeQueryPhase(SearchService.java:252)
at org.ElasticSearch.action.search.SearchTransportService$6.messageReceived(SearchTransportService.java:331)
at org.ElasticSearch.action.search.SearchTransportService$6.messageReceived(SearchTransportService.java:328)
at org.ElasticSearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69)
at org.ElasticSearch.transport.TransportService$7.doRun(TransportService.java:627)
at org.ElasticSearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:638)
at org.ElasticSearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
... 3 more
相关文章