# Query in .Net To get the values from ElasticSearch

**URL:** <https://discuss.elastic.co/t/query-in-net-to-get-the-values-from-elasticsearch/160095>\
**Category:** Elasticsearch\
**Created:** [December 10, 2018, 5:13am UTC](https://discuss.elastic.co/t/query-in-net-to-get-the-values-from-elasticsearch/160095 "2018-12-10T05:13:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![phanivempati](https://avatars.discourse-cdn.com/v4/letter/p/839c29/32.png) [@phanivempati](https://discuss.elastic.co/u/phanivempati)\
**Post date:** [December 10, 2018, 5:13am UTC](https://discuss.elastic.co/t/query-in-net-to-get-the-values-from-elasticsearch/160095/1 "2018-12-10T05:13:34Z")

</div>

Hi All,  
I am new to this elastic search and Nest. My query is simple, if i wrote in SQL it is something like below.

select \* from table1 where column1 = '123' and column2='text' and column3 in (12,11,13) and  
--datetime range

How to write the same query in .net to get the data from elastic search specific to one index.

elasticsearchclient.SearchAsync (s =\> s  
.SearchType(SearchType.QueryThenFetch)  
.Index(indexname)  
.Query(q =\> q  
.Bool (y =\> y  
.Must(mu =\> mu.Match(a =\> a.Field("column1").query("column1\_SearchValue")))  
mu =\> mu.Match(a =\> a.Field("Column2").Query(column2\_SearchValue))  
,c =\>c.Term("column3", column3\_searchvalue)  
).Filter  
(z =\> z.DateRange(r=\> r  
.Field(x =\> x.datetime)  
.greaterthanequal(fromdate)  
.lessthan(nowdate)  
)  
)  
)

I am able to search column1 and column2. But when i am include column3 i am not able to retrieve the values though i have the values. Filter is also working properly. I observed the third column value is passing as "1,2,3,4" instead of "1","2","3","4"

---

<div class="post-metadata">

**Author:** ![phanivempati](https://avatars.discourse-cdn.com/v4/letter/p/839c29/32.png) [@phanivempati](https://discuss.elastic.co/u/phanivempati)\
**Post date:** [December 10, 2018, 7:51am UTC](https://discuss.elastic.co/t/query-in-net-to-get-the-values-from-elasticsearch/160095/2 "2018-12-10T07:51:50Z")

</div>

solved the issue, instead of string i passed the list of ids.

---

<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:** [January 7, 2019, 7:51am UTC](https://discuss.elastic.co/t/query-in-net-to-get-the-values-from-elasticsearch/160095/3 "2019-01-07T07:51:53Z")

</div>

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