Elastic Search Child Object filter

Hi All,

I'm a beginner of Elasticsearch, My Elasticsearch response as below:

{
    "took": 30,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 2,
            "relation": "eq"
        },
        "max_score": null,
        "hits": [
            {
                "_index": "carserviceshop",
                "_type": "_doc",
                "_id": "0123567",
                "_score": null,
                "_source": {
                    "Shop": "Tom Car Repair Limited",
					"ServiceScope": [
						{
							"ServiceName" : "Air conditioning system",
							"MinimumCharge" : "500"
						},
						{
							"ServiceName" : "Car Cleaning",
							"MinimumCharge" : "200"
						}						
					]
				}
			},
			{
                "_index": "carserviceshop",
                "_type": "_doc",
                "_id": "0123567",
                "_score": null,
                "_source": {
                    "Shop": "Tom Car Repair Limited",
					"ServiceScope": [
						{
							"ServiceName" : "Wheel bearings and shock absorbers inspection",
							"MinimumCharge" : "200"
						},
						{
							"ServiceName" : "Car Cleaning",
							"MinimumCharge" : "300"
						}						
					]
				}
			}
		]
	}
}

I want to do filter the carservice which contain the service name : car cleaning, and the result will only show "Car Cleaning" only.
For equivalent SQL it will be

SELECT [Shop]  FROM [carserviceshop] S INNER JOIN 
(SELECT [ServiceName], [MinimumCharge] FROM [ServiceScope] WHERE [ServiceName] = 'Car Cleaning') N ON N.ShopID = S.ID

Thank you

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