Raise a warning if the 'query' param of the 'query' method of 'ElasticsearchDocumentStore' is not a string. (#1674)

This commit is contained in:
Sara Zan 2021-10-29 10:10:03 +02:00 committed by GitHub
parent ec816339bf
commit 08341f5698
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -721,6 +721,9 @@ class ElasticsearchDocumentStore(BaseDocumentStore):
# Default Retrieval via BM25 using the user query on `self.search_fields`
else:
if not isinstance(query, str):
logger.warning("The query provided seems to be not a string, but an object "
f"of type {type(query)}. This can cause Elasticsearch to fail.")
body = {
"size": str(top_k),
"query": {