Don't make the same ES query twice if there are no results (bug 975102)
Merge pull request #1831 from diox/es-no-results-count

Don't make the same ES query twice if there are no results (bug 975102)