elasticsearch sort by _id

3.6k views Asked by At

We had sort by _uid in elastic 5.x that is now deprecated

We upgraded existing 5.x data and elastic 6.8.3 is using it fine

but the sort fails

We changed the code to sort by _id, that works for newly created index

but the old one seems to be 5.x compatible still and the sort fails

"Fielddata access on the _id field is disallowed"
1

There are 1 answers

0
David Vasquez On

I had the same issue. An index restored from 5.6 to a 6.8 cluster is throwing the error.

"type": "script_exception",
"reason": "runtime error",
"Fielddata access on the _id field is disallowed"

To solve it I created a new index with the same mappings and reindexed the data.