"未知错误:mango_idx :: {no_usable_index,missing_sort_index}"} [英] "Unknown Error: mango_idx :: {no_usable_index,missing_sort_index}"}

查看:87
本文介绍了"未知错误:mango_idx :: {no_usable_index,missing_sort_index}"}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下查询:

{'type': 'text', 
 'name': 'album-rating-text', 
 'index': {'fields': [
                      {'type': 'string', 'name': 'user_id'}, 
                      {'type': 'string', 'name': 'album_id'}, 
                      {'type': 'number', 'name': 'timestamp'}
]}}

这里是查询:

{'sort': [
           {'user_id': 'desc'}, 
           {'album_id': 'desc'}, 
           {'timestamp': 'desc'}
         ], 
 'limit': 1, 
 'fields': ['user_id', 'album_id', 'timestamp'], 
 'selector': {
              '$and': [
                        {'user_id': {'$eq': 'a@a.com'}},         
                        {'album_id': {'$in': ['bf129f0d', '380e3a05'
                      ]
}}]}}

错误:

{ 
 "error":"unknown_error",
 "reason":"Unknown Error: mango_idx :: {no_usable_index,missing_sort_index}"
}

我见过一个类似的问题,但是,所有我正在索引的字段在我的排序列表中。

I've seen a similar question however, all the fields that I'm indexing on are in my sort list.

更新

作为一种解决方法,我尝试通过删除时间戳字段来简化操作:

As a workaround, I attempted to simplify by dropping the timestamp field:

{"type": "text", 
 "name": "album-rating-text", 
 "index": {"fields": [
               {"type": "string", "name": "user_id"}, 
               {"type": "string", "name": "album_id"}
 ]}}

并这样查询...

{"selector": {"$and": [
                   {"user_id": {"$eq": "a@a.com"}}, 
                   {"album_id": {"$in": ["bf129f0d", "380e3a05"]}
              }]}, 
 "fields": ["user_id", "album_id"]}

我收到以下错误:

 {"warning":"no matching index found, create an index to optimize query time",
"docs":[
]}


推荐答案

如果我没记错,我的查询要求发生了变化,我选择了使用标准的Cloudant 搜索索引代替芒果索引。

If I remember correct, my query requirements changed and I chose to use a standard Cloudant Search index instead of a Mango index.

这篇关于"未知错误:mango_idx :: {no_usable_index,missing_sort_index}"}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆