# ES query to find out the docs belonging to same document

**URL:** <https://discuss.elastic.co/t/es-query-to-find-out-the-docs-belonging-to-same-document/97263>\
**Category:** Elasticsearch\
**Created:** [August 16, 2017, 1:12pm UTC](https://discuss.elastic.co/t/es-query-to-find-out-the-docs-belonging-to-same-document/97263 "2017-08-16T13:12:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jyoti\_Shukla](https://avatars.discourse-cdn.com/v4/letter/j/a9a28c/32.png) [@Jyoti\_Shukla](https://discuss.elastic.co/u/Jyoti_Shukla)\
**Post date:** [August 16, 2017, 1:12pm UTC](https://discuss.elastic.co/t/es-query-to-find-out-the-docs-belonging-to-same-document/97263/1 "2017-08-16T13:12:59Z")

</div>

Hi,  
It would be helpful for me if any one responds to may question atleast.

Here's is the layman language for that-Select two geocodes such that geocodes belong to the same TripID and GroupID.....  
here is the structure of data.

"hits" : [  
{  
"\_index" : "1",  
"\_type" : "Route",  
"\_id" : "AV",  
"\_score" : 0.73998356,  
"\_source" : {  
"TripType" : "P",  
"Trips" : [  
{  
"Employees" : [  
{  
"ActualVehicleArrivalTime" : null,  
"RouteIndex" : 2,  
"EmployeeID" : "12",  
"Source\_Geocode" : "17.343188,78.469405"  
},  
{  
"ActualVehicleArrivalTime" : null,  
"RouteIndex" : 3,  
"EmployeeID" : "1004718",  
"Source\_Geocode" : "17.1,78.6"  
},  
{  
"ActualVehicleArrivalTime" : null,  
"RouteIndex" : 5,  
"EmployeeID" : "10",  
"Source\_Geocode" : "17,78"  
},  
{  
"ActualVehicleArrivalTime" : null,  
"RouteIndex" : 4,  
"EmployeeID" : "11",  
"Source\_Geocode" : "17.3,78.4"  
},....

i.e inside trips routeid is same for a particular trip array and group id is same for a particular employee array.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 13, 2017, 1:13pm UTC](https://discuss.elastic.co/t/es-query-to-find-out-the-docs-belonging-to-same-document/97263/2 "2017-09-13T13:13:07Z")

</div>

Closed on September 13, 2017, 1:13pm UTC

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