I am using java High level client API to fetch data, when using searchsourcebuilder by default it takes default 10 documents but i have more than 1,00,000 documents for this i am using searchSourceBuilder.from() and searchSourceBuilder.size() but doesn't show more than 10,000 documents results what i need to do?
sample code:
searchRequest.indices("winlogbeat-*");
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder.query(QueryBuilders.matchAllQuery());
searchSourceBuilder.from(0);
searchSourceBuilder.size(10000);
searchRequest.source(searchSourceBuilder);
SearchResponse searchResponse = client.search(searchRequest, RequestOptions.DEFAULT);
SearchHits hits = searchResponse.getHits();
System.out.println("Hits:"+hits);
List<Object> llist = new ArrayList<Object>();
for (SearchHit hit : searchResponse.getHits())
{
llist.add(hit.getSourceAsMap());
}
return llist;```
org.elasticsearch.ElasticsearchException: Elasticsearch exception [type=search_context_missing_exception, reason=No search context found for id [80]]
at org.elasticsearch.ElasticsearchException.innerFromXContent(ElasticsearchException.java:509) ~[elasticsearch-6.4.3.jar:6.4.3]
at org.elasticsearch.ElasticsearchException.fromXContent(ElasticsearchException.java:420) ~[elasticsearch-6.4.3.jar:6.4.3]```
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.