-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No handlers could be found for logger "elasticsearch" #67
Comments
Hi Chen, that is not an error from elasticsearch - it's just a message from the logging module informing you that you don't have logging configured. If you don't want logging it's nothing to be worried about. Although the code should work like this I strongly recommend you use keyword arguments to all es client methods Hope this helps, |
Thanks much Honza! |
This should actually be addressed in the |
has anything happened with this? Can confirm issue is still present |
@davidawad thanks for jumping in. I do not see this as an issue (as I expressed in #169). I see however, that other people view it as one. Could you please elaborate what is bothering you about the message? I am sorry if I seem obtuse (specially to @jmehnle), I just don't feel comfortable fixing something until I fully understand why it is an issue. I am by no means saying that you are wrong or that your opinion is not valid. Thanks for your patience. |
no big deal, it's only a problem because it prints a message to STDOUT everytime a python script using the module is run. Here's some code for example, running this gives that message. import elasticsearch
from elasticsearch_dsl import Search, Q
from datetime import datetime
# relevant docs
# http://stackoverflow.com/questions/24753569/what-causes-elasticsearch-exceptions-connectionerror-connectionerror-error/24753577#24753577
# http://xx.xx.xx.xx:9200/ -- shibly's instance
# http://elasticsearch-dsl.readthedocs.org/
# http://elasticsearch-py.readthedocs.org/en/latest/api.html
es = elasticsearch.Elasticsearch([{u'host': u'104.236.45.15', u'port': b'9200'}])
print es.indices.exists_alias('foo')
es.index(index="david", doc_type="test-type", id=42, body={"any": "data", "timestamp": datetime.now()})
client = es
s = Search(using=client, index="my-index") \
.filter("term", category="search") \
.query("match", title="python") \
.query(~Q("match", description="beta"))
s.aggs.bucket('per_tag', 'terms', field='tags') \
.metric('max_lines', 'max', field='lines')
response = s.execute()
for hit in response:
print(hit._meta.score, hit.title)
for tag in response.aggregations.per_tag.buckets:
print(tag.key, tag.max_lines.value)
print "success" |
not before a glorious exception call stack |
@davidawad the IP address you originally posted (I edited it out) has a publicly accessible elasticsearch instance running, that is dangerous and may very well lead to remote code execution by attackers. We highly recommend that you never expose your cluster to the outside world without protection of at least a proxy. |
If it's just the message appearing I actually personally consider that a feature since it brings attention to the fact that we have a logger defined. What do you think? The exception stack is most likely just a result of querying an index that doesn't exist, at least that is the exception I am getting from running this script. |
The issue is not so much any message being printed, it's a message being printed that looks like a code error, something that the user code is doing wrong. Which is not the case. |
@honzakral oh, of course, this is a junk instance for testing some of my scripts. |
any news/activity on this? personally I think the module should follow |
@filippog I don't understand, we are adding the
Also nothing should be ever printed on stdout, the logging uses stderr. Or am I missing something? Thanks 0 - https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library |
ah my bad! I was confused by the issue history, the null handler is indeed there in the last version -- all good, sorry for the noise 👍 |
I might miss something apparent, I am trying to call
if es.indices.exists_type(resource_index, resource_type) :
// delete my resource_type,
but always receive error No handlers could be found for logger "elasticsearch"
what does it mean? how can I call exists_type correctly?
Thanks,
Chen
The text was updated successfully, but these errors were encountered: