我有以下代码:
client = Elasticsearch(hosts=['host'], port=9200)
scan_arguments = {'query': {'slice': {'max': 1, 'id': 0}}, 'preference': '_shards:0', 'index': u'my_index'}
for hit in scan(client, **scan_args):
# do something with hit
我会收到以下错误
RequestError: TransportError(400, u'parsing_exception', u'[slice] failed to parse field [max]')
如何在扫描函数中传递切片参数?
" max"在我的经验中必须是> 1。使用" max"之前,我看到了相同的错误:1。
HTTP API的原始错误表示max
必须大于1。
{
"error": {
"root_cause": [
{
"type": "x_content_parse_exception",
"reason": "[3:20] [slice] failed to parse field [max]"
}
],
"type": "x_content_parse_exception",
"reason": "[3:20] [slice] failed to parse field [max]",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "max must be greater than 1"
}
},
"status": 400
}