Get the all field fromone documents Elasticsearch java -


i'm trying fields 1 document have lowest price. using min can particular price. how should retrieve in fields of 1 document.

i have written code retrieves min price

aggregationbuilder aggregation = aggregationbuilders.nested("nestedagg").path("carspecpojo")             .subaggregation(aggregationbuilders.min("carspecagg").field("carspecpojo.price"));     searchquery searchquery = (searchquery) new nativesearchquerybuilder()             .addaggregation(aggregation).build();      aggregations aggregations = elasticsearchtemplate.query(searchquery, new resultsextractor<aggregations>() {         @override         public aggregations extract(searchresponse response) {             return response.getaggregations();         }});     nested nest = aggregations.get("nestedagg");     min min = nest.getaggregations().get("carspecagg"); 

and elastic document

 "brand_name": "maruti",            "model": "i20",            "year": "2015",            "carspecpojo": {               "engine_power": "400hp",               "price": 9000000,               "transmission_type": "auto",               "airbag": "yes",               "abs": 1,               "max_speed": "170kmp",               "color": "black",               "fuel": "petrol",               "mileage": 5,               "door": 4,               "seat_capacity": 4            }         } 

when min price xxxxxxx, need fields in document

thanks in advance


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -