If a symbol has performed the buildAnalyticsModel workflow successfully, then the symbol is stored in the register_funds index and treated as registered. To update all the registered symbols, we need to know all the registered symbols. The getRegisterFunds() method from the EsDataService Spring Bean is used to get all the registered symbols. To perform a search request to retrieve all symbols, we construct a SearchRequest object, which embeds a SearchSourceBuilder object to create a match all query. The following code block shows the source code:
SearchRequest request = new SearchRequest(registerIndexName);
SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
RequestOptions options = RequestOptions.DEFAULT; request.source(sourceBuilder.query(
QueryBuilders.matchAllQuery()).sort("symbol", SortOrder.DESC));
......
response = restClient.search(request, options);
In the next section, we will discuss the final task: building the scheduler to update data automatically.