Hi,
I would like to know how to query the same result by using Java transport client.
In Elasticsearch Head:
I fire the query below through POST API _search:
{
"query": {},
"from": 100,
"size": 20,
"sort": [
{
"date_of_post": {
"order": "asc"
}
}
]
}
It returns result with total hits = 102953. See attachment.
In Java code, I code as below:
response = client.prepareSearch(indexName)
.setQuery(null)
.setFrom(9000)
.setSize(20)
.addSort("date_of_post", SortOrder.ASC)
.execute()
.actionGet();
It return zero hits (hits = null),
with totalHits = 200 (always equals to 200).
Why is it different from the REST API call? What have I done wrong?
Thank you.