Cloudant: No index exists for this sort, try indexing by the sort fields

别来无恙 提交于 2019-12-04 19:24:09

If you want to sort by position then try this query:

{
  "selector": {
    "type": "CUSTOM_TYPE",
    "position": {"$gte": 0}
  },
  "fields": [
    "_id",
    "type",
    "position"
  ],
  "sort": [
    {
      "position": "asc"
    }
  ]
}

The position field needs to be part of the selector. I set it to match any position that is >= 0, so it should match all unless it's null.

Also, you were sorting by _id and then position. This would render the position sort meaningless. I removed the _id field from the sort.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!