Read the Headers in the index using Elasticsearch Java API


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()){

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.
Sanjay Reddy.

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