我在 AWS Elasticsearch 上有一个索引,由于NODE_LEFT. 这是输出_cat/shards
rawindex-2017.07.04 1 p STARTED
rawindex-2017.07.04 3 p UNASSIGNED NODE_LEFT
rawindex-2017.07.04 2 p STARTED
rawindex-2017.07.04 4 p STARTED
rawindex-2017.07.04 0 p STARTED
Run Code Online (Sandbox Code Playgroud)
在正常情况下,使用_clusteror可以很容易地重新分配这些分片_settings。但是,这些是 AWS 不允许的确切 API。我收到以下消息:
{
Message: "Your request: '/_settings' is not allowed."
}
Run Code Online (Sandbox Code Playgroud)
根据对一个非常相似的问题的回答,我可以使用_indexAWS 允许的 API更改索引的设置。但是,它似乎index.routing.allocation.disable_allocation对我正在运行的 Elasticsearch 5.x 无效。我收到以下错误:
{
"error": {
"root_cause": [
{
"type": "remote_transport_exception",
"reason": "[enweggf][x.x.x.x:9300][indices:admin/settings/update]"
}
],
"type": "illegal_argument_exception",
"reason": "unknown setting [index.routing.allocation.disable_allocation] please check that any …Run Code Online (Sandbox Code Playgroud) 假设我用 指定一个 MongoDB 游标pymongo,它不包括结果集中的所有字段,如下所示:
from pymongo import MongoClient
conn = MongoClient('mongodb://localhost:27017')
cur = conn['my_db']['my_collection'].find({},{'_id' : 0, 'my_unwanted_field' : 0})
Run Code Online (Sandbox Code Playgroud)
是否有一个函数或属性可以返回cur.
在 Mongo Shell 上使用的等效内容findOne是:
> var cur = findOne({},{'_id' : 0, 'my_unwanted_field' : 0})
> Object.keys(cur)
["field_1", ... , "field_n"]
Run Code Online (Sandbox Code Playgroud) 我有来自 MongoDB 游标的数据转储,例如示例:
>>> json_list
[{u'rDate': u'05/04/2009', u'_id': ObjectId('56c20bf2dc5e3753986b5564')},
{u'rDate': u'06/09/2009', u'_id': ObjectId('56c20be5dc5e3753986b5563')},
{u'rDate': u'12/08/2008', u'_id': ObjectId('56c20bf2dc5e3753986b5566')},
{u'rDate': u'12/21/2008', u'_id': ObjectId('56c20bf2dc5e3753986b5565')}]
Run Code Online (Sandbox Code Playgroud)
Python 有没有办法按日期升序对它们进行排序?就像示例中一样,生成的排序列表将是:
>>> json_list
[{u'rDate': u'12/08/2008', u'_id': ObjectId('56c20bf2dc5e3753986b5566')},
{u'rDate': u'12/21/2008', u'_id': ObjectId('56c20bf2dc5e3753986b5565')},
{u'rDate': u'05/04/2009', u'_id': ObjectId('56c20bf2dc5e3753986b5564')},
{u'rDate': u'06/09/2009', u'_id': ObjectId('56c20be5dc5e3753986b5563')}]
Run Code Online (Sandbox Code Playgroud)
我已经查看了大多数相关示例,但它们的日期格式与"update_time": "1415387875"我的情况不同。欢迎任何帮助。
谢谢!