Hi,
I'm using python to connect to elastic as following:
import urllib3
from elasticsearch import Elasticsearch
from elasticsearch.connection import create_ssl_context
import configparser
def get_es_session(es_user, es_password, es_host, es_port):
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
ssl_context = create_ssl_context()
ssl_context.check_hostname = False
ssl_context.verify_mode = False
es_session = Elasticsearch(
hosts=[{'host': es_host, 'port': es_port}],
scheme='https',
ssl_context=ssl_context,
http_auth=(es_user, es_password))
return es_session
Then I'm trying to do the simplest search but getting the error above (Expected [SRART_OBJECT] but found [START_ARRAY]):
es_session = get_es_session(es_user, es_password, es_host, es_port)
#Init scroll by search
res = es_session.search(index='digital-dashboard*',
size=10000,
from_=0,
request_timeout=60,
body=body,
scroll='5m',
)
The body I'm passing is minimal as it can get:
{
"query": {
"bool": {
"filter": {
"range": { "@timestamp": { "gt": "2021-07-12T13:28:54.297000" } }
}
}
}
}
I even tried passing it as json and not a dictionary using json.dumps but nothing seems to work.
Any ideas will be much much appreciated.