Hi,
I'm using Elasticsearch Java API 2.4.2 to fetch the data from Elasticsearch. Currently, by using the following code, I'm able to get the headers but what I need is to fetch the headers based on the data types of the field.
Set<String> fieldSet = new HashSet<String>();
BoolQueryBuilder query = new BoolQueryBuilder();
SearchRequestBuilder req = client.prepareSearch(idxName).setSearchType(SearchType.DFS_QUERY_THEN_FETCH);
SearchResponse response = req.setQuery(query).execute().actionGet();
for(SearchHit hit : response.getHits()){
fieldSet.addAll(hit.getSource().keySet());
break;
}
for example, If there is a field AGE (INT) with integer data type, it should be added to numericalFieldSet, if it is a String, then add that header to fieldSet.
Any help would be appreciated.
Thanks,
Sanjay Reddy.