question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Warning when using Elasticsearch.exists and document doesn't exists

See original GitHub issue

It seems like Elasticsearch.exists raises a warning when the if the document could not be located in the specified index (in addition to the False returned value).

Is this the expected/designed behavior or am I doing something wrong?

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
reywoodcommented, Mar 11, 2015

Disabling all warnings just to get rid of one erroneous warning seems less than ideal. Logging is meant to provide valuable information. Wouldn’t doing something like this in the exists method work:

params['ignore'] = 404
status, _ = self.transport.perform_request('HEAD', _make_path(index, doc_type, id), params=params)
return status == 200

Doesn’t require a change to the connection logic and seems pretty reasonable.

2reactions
honzakralcommented, Jan 6, 2015

Oh, if you are in iPython notebook then logging has already been configured so basicConfig won’t work, instead do:

import logging
logger = logging.getLogger("elasticsearch")
logger.setLevel(logging.ERROR)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Exists query | Elasticsearch Guide [8.5] | Elastic
Returns documents that contain an indexed value for a field. An indexed value may not exist for a document's field due to a...
Read more >
Best way to check if a field exist in an Elasticsearch document
Best way to check if a field exist in an Elasticsearch document - Stack Overflow. Stack Overflow for Teams – Start collaborating and...
Read more >
42 Elasticsearch Query Examples - Tutorial - Coralogix
Sometimes it happens that there is no indexed value for a field, or the field does not exist in the document. In such...
Read more >
API Documentation — Elasticsearch 7.16.0 documentation
If using SSL, but don't verify the certs, a warning message is showed ... Returns a 409 response when a document with a...
Read more >
Elasticsearch DSL Exists Query - Implementation & Use with ...
Some fields in documents may not have an indexed value due to several reasons. The exists query is used for returning the documents...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found