I have a problem that persists for a few days and I cannot solve it.
I have a simple document in my database which looks like this:
{
"_id": "asd123",
"_rev": "revidasd123",
"type": "CUSTOM_TYPE",
"position": 8,
"title": "Short custom title"
}
When I try to make a sort by position, even if I have created an index for this field, I always get the same error:
Error: no_usable_index. Reason: No index exists for this sort, try indexing by the sort fields.
Here is the index:
{
"type": "json",
"def": {
"fields": [
{
"position": "asc"
}
]
}
}
And here is my query which cause this error:
{
"selector": {
"type": "CUSTOM_TYPE",
"_id":{
"$gt": null
}
},
"fields": [
"_id",
"type",
"position"
],
"sort": [
{
"_id": "asc"
},
{
"position": "asc"
}
]
}
Result: No index exists for this sort, try indexing by the sort fields.
Please HELP! Thanks in advance