Turn off “Elasticsearch built-in security features are not enabled” notifications from Python?

With respect to this question

Which is about silencing the error

ElasticsearchWarning: Elasticsearch built-in security features are not enabled. Without authentication, your cluster could be accessible to anyone. See https://www.elastic.co/guide/en/elasticsearch/reference/7.13/security-minimal-setup.html to enable security.

Is it possible to do what was suggested from Python?

I tried these two solutions but they didn't work:

import logging
logger = logging.getLogger("elasticsearch")
logger.setLevel(logging.ERROR)
es_logger = elasticsearch.logger
es_logger.setLevel(elasticsearch.logging.ERROR)

Thanks a lot.

I got a solution that works from Getting ElasticsearchWarning on search request · Issue #1878 · elastic/elasticsearch-py · GitHub

import warnings
from elasticsearch.exceptions import ElasticsearchWarning
warnings.simplefilter('ignore', ElasticsearchWarning)

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.