From ad99c6b4892f625cfd9819a65da598aa04d3a18a Mon Sep 17 00:00:00 2001 From: Justin Ibarra Date: Wed, 6 Apr 2022 11:52:22 -0800 Subject: [PATCH] Update elasticsearch dependency to 8.1 (#1911) --- detection_rules/eswrap.py | 2 +- detection_rules/misc.py | 5 +++-- requirements.txt | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/detection_rules/eswrap.py b/detection_rules/eswrap.py index bc4ccae1f..8b9e722fa 100644 --- a/detection_rules/eswrap.py +++ b/detection_rules/eswrap.py @@ -13,7 +13,7 @@ from typing import Union import click import elasticsearch from elasticsearch import Elasticsearch -from elasticsearch.client.async_search import AsyncSearchClient +from elasticsearch.client import AsyncSearchClient import kql from .main import root diff --git a/detection_rules/misc.py b/detection_rules/misc.py index e48154428..768c2693e 100644 --- a/detection_rules/misc.py +++ b/detection_rules/misc.py @@ -358,7 +358,8 @@ elasticsearch_options = list(client_options['elasticsearch'].values()) def add_client(*client_type, add_to_ctx=True, add_func_arg=True): """Wrapper to add authed client.""" - from elasticsearch import Elasticsearch, ElasticsearchException + from elasticsearch import Elasticsearch + from elasticsearch.exceptions import AuthenticationException from kibana import Kibana def _wrapper(func): @@ -391,7 +392,7 @@ def add_client(*client_type, add_to_ctx=True, add_func_arg=True): pass else: elasticsearch_client = get_elasticsearch_client(use_ssl=True, **es_client_args) - except ElasticsearchException: + except AuthenticationException: elasticsearch_client = get_elasticsearch_client(use_ssl=True, **es_client_args) if add_func_arg: diff --git a/requirements.txt b/requirements.txt index 077a9cabb..75378aefd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,11 @@ jsl==0.2.4 pytoml toml==0.10.0 -requests==2.22.0 +requests~=2.27 Click==7.0 PyYAML~=5.3 eql==0.9.12 -elasticsearch~=7.9 +elasticsearch~=8.1 XlsxWriter~=1.3.6 marshmallow~=3.13.0 marshmallow-dataclass[union]~=8.5.3