# Hits.hits array empty even thought total =1

**URL:** https://discuss.elastic.co/t/hits-hits-array-empty-even-thought-total-1/19930
**Category:** Elasticsearch
**Created:** [September 23, 2014, 10:51pm UTC](https://discuss.elastic.co/t/hits-hits-array-empty-even-thought-total-1/19930 "2014-09-23T22:51:13Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Stephen\_Ward](https://avatars.discourse-cdn.com/v4/letter/s/a88e57/32.png) [@Stephen\_Ward](https://discuss.elastic.co/u/Stephen_Ward)
#### Post date: [September 23, 2014, 10:51pm UTC](https://discuss.elastic.co/t/hits-hits-array-empty-even-thought-total-1/19930/1 "2014-09-23T22:51:13Z")

</div>

I have a node app using the javascript api.

even the the query returns a hit. I get the following response

"hits": {

```
  "total": 1,

  "max_score": 14.627042,

  "hits": []

}

```

how can the hits array be empty when the total shows 1.. If I run the query  
in sense I get the expected result.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/26eca414-2963-4f11-be0b-f8a88c944bc3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/26eca414-2963-4f11-be0b-f8a88c944bc3%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Stephen\_Ward](https://avatars.discourse-cdn.com/v4/letter/s/a88e57/32.png) [@Stephen\_Ward](https://discuss.elastic.co/u/Stephen_Ward)
#### Post date: [September 24, 2014, 6:20pm UTC](https://discuss.elastic.co/t/hits-hits-array-empty-even-thought-total-1/19930/2 "2014-09-24T18:20:44Z")

</div>

Duh . my page started at 1 not 0.

On Tuesday, September 23, 2014 3:51:14 PM UTC-7, Stephen Ward wrote:

> I have a node app using the javascript api.
> 
> even the the query returns a hit. I get the following response
> 
> "hits": {
> 
> ```
> "total": 1,
> 
> "max_score": 14.627042,
> 
> "hits": []
> 
> }
> 
> ```
> 
> how can the hits array be empty when the total shows 1.. If I run the  
> query in sense I get the expected result.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/af945b06-26fc-4598-9e80-7226c659f5ca%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/af945b06-26fc-4598-9e80-7226c659f5ca%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Arpit\_Agarwal](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@Arpit\_Agarwal](https://discuss.elastic.co/u/Arpit_Agarwal)
#### Post date: [May 21, 2016, 8:42pm UTC](https://discuss.elastic.co/t/hits-hits-array-empty-even-thought-total-1/19930/3 "2016-05-21T20:42:50Z")

</div>

By default, elasticsearch starts showing its Query results from pageNum as 0 and the search query we define generally start from pageNum as 1. Ensure that if you are setting the pageNum, it is set to 0 in case you have the resultset within the pageSize limit.

I was facing the same issue where I could see total\_hits as 1 with empty array being returned. I found that I was setting the default pageNum to 1 ,however elasticsearch starts it from 0 and hence was returning the second page when queried with pageNum as 1

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 5, 2017, 10:49pm UTC](https://discuss.elastic.co/t/hits-hits-array-empty-even-thought-total-1/19930/4 "2017-07-05T22:49:57Z")

</div>


