这是我的查询:
{
"selector": {
"_id": {
"$regex": "^rati" //need to find all documents in ratings partition
}
},
"fields": [
"MovieID",
"UserId",
"Rating"
],
"limit": 10,
"sort": [
{
"MovieID": "asc"
}
]
}
当我运行这个查询时,我有这个错误:Error running query. Reason: (no_usable_index) No global index exists for this sort, try indexing by the sort fields.
如果我删除
"sort": [
{
"MovieID": "asc"
}
]
一切正常。老实说,我快疯了,我不明白我错在哪里。
我试过这个查询:
{
"selector": {
"_id": {
"$regex": "^rati"
},
"MovieID": {
"$gte": 0
}
},
"fields": [
"_id",
"MovieID",
"UserId",
"Rating"
],
"limit": 10,
"sort": [
{
"_id": "asc"
}
]
}
但是是一样的。