Multiple/Join query on same index

I want to know the Elastic search query for 
select * from 
(Select sum(income) from users where users.name like '%abc%' group by users.address) aResult,
(select count(*), phone number from users where users.name like '%XXX%' group by users.address, users.phone, users.pin ) bResult where aResult.id = bResult.Id

As Elasticsearch does not support joins I do not think that can be directly translated to a query. If you tell us about your data and what you are looking to achieve someone might be able to help you structure the data and a query to achieve what you are looking for.

Stating the actual problem instead of symoblic (user index).
I want to get sum of Laptops distributed by every LOB  [ field_name column has 'LOB' text  and its actual lob name is under column 'FIeld_value' ] 
plus under each head [field_name column has text 'HEAD' and field_value has all person heading the LOB's ] i need the count of employee's  group by region & LOB

------------ sample response  ---------------
Lob: Tech1
Count of laptops: 34
details {
	subLob0: {
	name: tech1-subLob0,
	count of resource: 3
	},
	subLob1: {
	name: tech1-subLob1,
	count of resource: 3
	},
	subLob2: {
	name: tech1-subLob2,
	count of resource: 3
	}
}

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