---
title: "elasticsearch 排序异常,关键字冲突"
author: "Horsemen"
date: "2016-02-03T12:35:44Z"
tags: []
categories: ["数据库"]
slug: "elasticsearch"
draft: false
lastmod: "2016-02-03T12:35:44Z"
id: 2275640
url: "https://horsemen.iteye.com/blog/2275640"
---

org.elasticsearch.action.search.SearchPhaseExecutionException: Failed to execute phase [query], all shards failed; shardFailures {[AiJ8JiX6SBGS-Tq0V5mrDA][tickets_v1][0]: QueryPhaseExecutionException[[tickets_v1][0]: query[filtered(*:*)->cache(_type:its_tickets)],from[0],size[20],sort[<custom:"update_time": org.elasticsearch.index.fielddata.fieldcomparator.LongValuesComparatorSource@606a5e5b>!]: Query Failed [Failed to execute main query]]; nested: ElasticsearchException[java.lang.ArrayIndexOutOfBoundsException]; nested: UncheckedExecutionException[java.lang.ArrayIndexOutOfBoundsException]; nested: ArrayIndexOutOfBoundsException; }{[AiJ8JiX6SBGS-Tq0V5mrDA][tickets_v1][1]: QueryPhaseExecutionException[[tickets_v1][1]: query[filtered(*:*)->cache(_type:its_tickets)],from[0],size[20],sort[<custom:"update_time": org.elasticsearch.index.fielddata.fieldcomparator.LongValuesComparatorSource@71015316>!]: Query Failed [Failed to execute main query]]; nested: ElasticsearchException[java.lang.ArrayIndexOutOfBoundsException]; nested: UncheckedExecutionException[java.lang.ArrayIndexOutOfBoundsException]; nested: ArrayIndexOutOfBoundsException; }{[AiJ8JiX6SBGS-Tq0V5mrDA][tickets_v1][2]: QueryPhaseExecutionException[[tickets_v1][2]: query[filtered(*:*)->cache(_type:its_tickets)],from[0],size[20],sort[<custom:"update_time": org.elasticsearch.index.fielddata.fieldcomparator.LongValuesComparatorSource@2ea14ed8>!]: Query Failed [Failed to execute main query]]; nested: ElasticsearchException[java.lang.ArrayIndexOutOfBoundsException]; nested: UncheckedExecutionException[java.lang.ArrayIndexOutOfBoundsException]; nested: ArrayIndexOutOfBoundsException; }{[AiJ8JiX6SBGS-Tq0V5mrDA][tickets_v1][3]: QueryPhaseExecutionException[[tickets_v1][3]: query[filtered(*:*)->cache(_type:its_tickets)],from[0],size[20],sort[<custom:"update_time": org.elasticsearch.index.fielddata.fieldcomparator.LongValuesComparatorSource@586642f4>!]: Query Failed [Failed to execute main query]]; nested: ElasticsearchException[java.lang.ArrayIndexOutOfBoundsException]; nested: UncheckedExecutionException[java.lang.ArrayIndexOutOfBoundsException]; nested: ArrayIndexOutOfBoundsException; }{[AiJ8JiX6SBGS-Tq0V5mrDA][tickets_v1][4]: QueryPhaseExecutionException[[tickets_v1][4]: query[filtered(*:*)->cache(_type:its_tickets)],from[0],size[20],sort[<custom:"update_time": org.elasticsearch.index.fielddata.fieldcomparator.LongValuesComparatorSource@26b1a384>!]: Query Failed [Failed to execute main query]]; nested: ElasticsearchException[java.lang.ArrayIndexOutOfBoundsException]; nested: UncheckedExecutionException[java.lang.ArrayIndexOutOfBoundsException]; nested: ArrayIndexOutOfBoundsException; }
	at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.onFirstPhaseResult(TransportSearchTypeAction.java:237)
	at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$1.onFailure(TransportSearchTypeAction.java:183)
	at org.elasticsearch.search.action.SearchServiceTransportAction$23.run(SearchServiceTransportAction.java:565)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)

解决办法:
将表中update_time关键字段的名称, 改为非关键字的即可,例如updt_time