From 3bcbc4ab3b99670f12f1149b4ab0bc7cdd47f6a6 Mon Sep 17 00:00:00 2001 From: Artem Skoretskiy Date: Thu, 16 Aug 2018 10:22:48 +0400 Subject: [PATCH] Fixed doc_type check doc_type to `search` method is list, while `document['_type']` is a string. --- elasticmock/fake_elasticsearch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elasticmock/fake_elasticsearch.py b/elasticmock/fake_elasticsearch.py index 909f072..e30c94d 100644 --- a/elasticmock/fake_elasticsearch.py +++ b/elasticmock/fake_elasticsearch.py @@ -156,7 +156,7 @@ def search(self, index=None, doc_type=None, body=None, params=None): matches = [] for searchable_index in searchable_indexes: for document in self.__documents_dict[searchable_index]: - if doc_type is not None and document.get('_type') != doc_type: + if doc_type is not None and document.get('_type') not in doc_type: # value in a list of allowed doc_types continue matches.append(document)