RequestOptions cannot be resolved to a variable

I am trying to search the data in ES using RestHighLevelClient and referring the documentation available at ( but getting a compilation error "RequestOptions cannot be resolved to a variable" at line ", RequestOptions.DEFAULT);"
Could you please let me know the right way to search the data using RestHighLevelClient.

ES version: 6.3.2


RestHighLevelClient client = new RestHighLevelClient(
                RestClient.builder(new HttpHost("localhost", 9200, "http"))
                    .setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() {
                        public RequestConfig.Builder customizeRequestConfig(RequestConfig.Builder requestConfigBuilder) {
                            return requestConfigBuilder.setConnectTimeout(5000)
SearchRequest searchRequest = new SearchRequest("");
										  SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
										  SearchResponse searchResponse =, RequestOptions.DEFAULT);

The problem here is that you're trying to use the master documentation against 6.3. Instead, you should be using the 6.3 docs. You can get to the 6.3 docs from the master docs by clicking the version drop down on the right-hand side of the page. If you follow this, you will see that RequestOptions is not referenced there (because we only added it in 6.4), and that instead the code you want is:

SearchResponse searchResponse =;

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.