将Python包elasticsearch从7.6.0更新到8.1.0后,我开始在这行代码中收到错误:
count = es.count(index=my_index, body={'query': query['query']} )["count"]
Run Code Online (Sandbox Code Playgroud)
收到以下错误消息:
DeprecationWarning:“body”参数已弃用,并将在未来版本中删除。而是使用单独的参数。
count = es.count(index=ums_index, body={'query': query['query']} )["count"]
我不明白如何使用上述“个别参数”。这是我的查询:
query = {
"bool": {
"must":
[
{"exists" : { "field" : 'device'}},
{"exists" : { "field" : 'app_version'}},
{"exists" : { "field" : 'updatecheck'}},
{"exists" : { "field" : 'updatecheck_status'}},
{"term" : { "updatecheck_status" : 'ok'}},
{"term" : { "updatecheck" : 1}},
{
"range": {
"@timestamp": {
"gte": from_date,
"lte": to_date,
"format": "yyyy-MM-dd HH:mm:ss||yyyy-MM-dd"
}
}
}
],
"must_not":
[
{"term" …Run Code Online (Sandbox Code Playgroud)