# Parse query to NEST(.net client for elasticsearch)

**URL:** <https://discuss.elastic.co/t/parse-query-to-nest-net-client-for-elasticsearch/28500>\
**Category:** Elasticsearch\
**Created:** [September 2, 2015, 8:49am UTC](https://discuss.elastic.co/t/parse-query-to-nest-net-client-for-elasticsearch/28500 "2015-09-02T08:49:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bientd](https://avatars.discourse-cdn.com/v4/letter/b/54ee81/32.png) [@bientd](https://discuss.elastic.co/u/bientd)\
**Post date:** [September 2, 2015, 8:49am UTC](https://discuss.elastic.co/t/parse-query-to-nest-net-client-for-elasticsearch/28500/1 "2015-09-02T08:49:09Z")

</div>

I'm trying to parse this query to NEST but no luck.

{  
"query" : {  
"filtered" : {  
"filter" : {  
"and": [  
{  
"nested" : {  
"path" : "skills",  
"filter" : {  
"bool" : {  
"must" : [  
{  
"term" : {"skills.id" : 343}  
},  
{  
"range" : {"skills.level" : {"gt" : 3}}  
}  
]  
}  
}  
}  
},  
{  
"nested" : {  
"path" : "jobs",  
"filter" : {  
"bool" : {  
"must" : [  
{  
"term" : {"jobs.jobid" : 621}  
}  
]  
}  
}  
}  
}  
]  
}  
}  
}  
}

Anyone experience with it. Please help me to translate that query use FilterDescriptor.  
Thanks in advanced!

---

<div class="post-metadata">

**Author:** ![gmoskovicz](https://avatars.discourse-cdn.com/v4/letter/g/ecae2f/32.png) [@gmoskovicz](https://discuss.elastic.co/u/gmoskovicz)\
**Post date:** [September 2, 2015, 6:53pm UTC](https://discuss.elastic.co/t/parse-query-to-nest-net-client-for-elasticsearch/28500/2 "2015-09-02T18:53:16Z")

</div>

Hi **Bien** ,

This should be what you are looking for:

```auto
var result = client.Search<Type>(
		s => s.Query(
				q => q.Filtered(
						f => f.Filter(
								f1 => f1.And(
										a1 => a1.Nested(
												n => n.Path("skills").Filter(
														nf => nf.Bool(
																nf1 => nf1.Must(
																		m1 => m1.Term("skills.id", 343),
																		m1 => m1.Range(r1 => r1.OnField("skills.level").Greater(3))
																		)
																	)
																)
													),
									a2 => a2.Nested(
											n => n.Path("jobs").Filter(
													nf => nf.Bool(b => b.Must(bm => bm.Term("jobs.job.id", 621)))
																)
													)
					)
			)
	)));

```

Thanks!

--Gabriel

---

<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:** [July 5, 2017, 11:52pm UTC](https://discuss.elastic.co/t/parse-query-to-nest-net-client-for-elasticsearch/28500/3 "2017-07-05T23:52:31Z")

</div>


