# How to configure elasticsearch nested query in granfana

**URL:** <https://community.grafana.com/t/how-to-configure-elasticsearch-nested-query-in-granfana/24942>\
**Category:** Elasticsearch\
**Created:** [January 20, 2020, 5:30pm UTC](https://community.grafana.com/t/how-to-configure-elasticsearch-nested-query-in-granfana/24942 "2020-01-20T17:30:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![neeraj121296](https://avatars.discourse-cdn.com/v4/letter/n/bc8723/32.png) [@neeraj121296](https://community.grafana.com/u/neeraj121296)\
**Post date:** [January 20, 2020, 5:30pm UTC](https://community.grafana.com/t/how-to-configure-elasticsearch-nested-query-in-granfana/24942/1 "2020-01-20T17:30:30Z")

</div>

I have this type of json data :

{  
“@timestamp”: “2020-01-19T15:29:50+02:00”,

```
"Boards": [{

	"Name": "Agile_Board_1",
	"id": 123,
	"Sprints": [{

			"SprintName": "Sprint_1",
			"State": "Active",
			"Issues": [{

					"Key": "JIRA-1856",
					"Assignee": "Sam",
					"Status": "Open",
					"Type": "Story",
					"StoryPoint": 5
				},
				{
					"Key": "JIRA-2356",
					"Assignee": "Shubham",
					"Status": "Closed",
					"Type": "Fix",
					"StoryPoint": 8

				},
				{
					"Key": "JIRA-2656",
					"Assignee": "Lucky",
					"Status": "In Progress",
					"Type": "Defect",
					"StoryPoint": 8

				}
			]
		},
		{

			"SprintName": "Sprint_2",
			"State": "Closed",
			"Issues": [{

					"Key": "JIRA-1859",
					"Assignee": "KARAN",
					"Status": "Open",
					"Type": "Story",
					"StoryPoint": 5
				},
				{
					"Key": "JIRA-1858",
					"Assignee": "Shubham",
					"Status": "Closed",
					"Type": "Fix",
					"StoryPoint": 8

				},
				{
					"Key": "JIRA-1859",
					"Assignee": "Lucky",
					"Status": "In Progress",
					"Type": "Defect",
					"StoryPoint": 8

				}
			]
		}

	]
}]

```

}

I want to apply lucene query to filter out the data with “Boards.Sprints.Issues.Status”: “Open”,  
As to filter out the data i want to use nested aggregation with filtered sub aggregation which contains `top_hits` sub aggregation. The query looks like:  
{  
“size”: 0,  
“aggs”: {  
“nested”: {  
“nested”: {  
“path”: “Boards.Sprints.Issues”  
},  
“aggs”: {  
“filter”: {  
“filter”: {  
“match”: { “Boards.Sprints.Issues.Status”: “Open” }  
},  
“aggs”: {  
“t”: {  
“top\_hits”: {  
“size”: 100  
}  
}  
}  
}  
}  
}  
}  
}

So how to use this king aggregated nested query in grafana?
