我用helpers.scan查询,没问题,但是想打印结果,就会报错
会打印出来一串6,然后就报错
报错是
elasticsearch.exceptions.AuthorizationException: AuthorizationException(403, 'security_exception', 'no permissions for indices:data/read/scroll/clear')
新手求各位老哥指点,么么哒
------------------------------------------------
我在kibana里查询了下,是69个结果,而python里输出完第69个结果就报错了,请问为什么呀,是不是for循环写的有问题?
from elasticsearch import Elasticsearch
from elasticsearch import helpers
import certifi
import requests
import json
import arrow
from helper import *
def query_data(es, index, body, scroll='1m', request_timeout=60):
result = helpers.scan(
client=es,
query=body,
scroll=scroll,
index=index,
request_timeout=request_timeout
)
return result
def get_result_list(es_result):
final_result =
for item in es_result:
final_result.append(item['_source'])
return final_result
body = {
"query":{
"bool":{
"must":[
{
"term":{
"btn.keyword":"btnNext"
}
},
{
"term":{
"type":"anno_op"
}
}
]
}
}
}
#下面这里报错
res = query_data(es, "label", body)
s = 0
for resp in res:
print(resp)
s = s + 1
print(s)
会打印出来一串6,然后就报错
报错是
elasticsearch.exceptions.AuthorizationException: AuthorizationException(403, 'security_exception', 'no permissions for indices:data/read/scroll/clear')
新手求各位老哥指点,么么哒
------------------------------------------------
我在kibana里查询了下,是69个结果,而python里输出完第69个结果就报错了,请问为什么呀,是不是for循环写的有问题?
2 个回复
zqc0512 - andy zhou
赞同来自:
你没有用户名和密码认证吧
kennywu76 - Wood
赞同来自: