Some time ago I came across a really annoying error in Elasticsearch.
The error log was something like this:
SearchPhaseExecutionException[Failed to execute phase [query], all shards failed; shardFailures {[_9x6xIKhTXK7y_jqC92YIQ][index][0]: ElasticicsearchException[java.lang.NumberFormatException:Invalid shift value in prefixCoded bytes (is encoded value really an INT?)]; nested:UncheckedExecutionException[java.lang.NumberFormatException: Invalid shift value in prefixCoded bytes (is encoded value really an INT?)]; nested: NumberFormatException[Invalid shift value in prefixCoded bytes (is encoded value really an INT?)]; }
It was driving me nuts to find out what the exact problem was. I searched several hours in the internet for an answer until I found a helpful post in a forum.
The actual problem is that there is a field in your Elasticsearch index, which have different mapping settings in different types.
I.e. you have the type car and the type driver and both are types of the index company. Both tpes have an ID. But one is declare as integer value and the other is a string.
Elasticsearch doesn’t make a difference between fields in different types but with the same name in the same index. So check your mappings to solve the problem.
But be aware. After I changed my mappings I still got the error message. After changing the values I also needed to clear my index to delete all old documents.
For deleting all old cached documents I made an optimize POST request to elasticsearch:
http://elasticsearch:9200/[index]/_optimize?max_num_segments=1&wait_for_merge=false/
The params are really important otherwise the documents will not be deleted. After that everything worked fine again.
I hope I could help you with my post and save you some valuable time of research:)