I know for a fact that:
Elasticsearch may hold more than Integer.MAX_VALUE documents in one index, due to sharding (each shard is one Lucene index)
Elasticsearch expects integers for the limit and offset (bug?)
Lucene only ever works with integers
I don't know how Elasticsearch behaves when returning a hit count greater than Integer.MAX_VALUE; maybe it fails due to an overflow.
We should define the expected behavior for these APIs and add tests, because we currently only ever test with default values and very small values.
While we’re at it, let’s test the default value for limits more thoroughly: Elasticsearch has a default of 10 or so, and I don’t think we override it properly. => Fixed in
Neither Lucene nor Elasticsearch supports limits or offsets higher than Integer.MAX_SIZE. Cancelling this ticket; I opened HSEARCH-3577.