From 881438de7c6d070c91adc4725d445630a4151342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Tue, 7 Apr 2015 10:27:20 +0200 Subject: [PATCH] Make count consistent with search --- elasticsearch/client/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/elasticsearch/client/__init__.py b/elasticsearch/client/__init__.py index 5ae18e7e..0c28a10e 100644 --- a/elasticsearch/client/__init__.py +++ b/elasticsearch/client/__init__.py @@ -681,6 +681,9 @@ class Elasticsearch(object): :arg routing: Specific routing value :arg source: The URL-encoded query definition (instead of using the request body) """ + if doc_type and not index: + index = '_all' + _, data = self.transport.perform_request('POST', _make_path(index, doc_type, '_count'), params=params, body=body) return data