# Access Elastic via .NET

**URL:** <https://discuss.elastic.co/t/access-elastic-via-net/257116>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [November 30, 2020, 6:57pm UTC](https://discuss.elastic.co/t/access-elastic-via-net/257116 "2020-11-30T18:57:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amit5](https://avatars.discourse-cdn.com/v4/letter/a/f6c823/32.png) [@Amit5](https://discuss.elastic.co/u/Amit5)\
**Post date:** [November 30, 2020, 6:57pm UTC](https://discuss.elastic.co/t/access-elastic-via-net/257116/1 "2020-11-30T18:57:05Z")

</div>

Hi everyone

I need to query our elastic search and pull some data from it.  
I read about about couple of ways to to it. What I tried so far is to Use NEST to query elastic:  
var response = client.Get(10, idx =\> idx.Index("graylog\_\*"));  
var searchResponse = client.Search(s =\> s  
.From(0)  
.Size(1000)  
.Scroll("10m")  
.Query(q =\> q  
.Match(m =\> m  
.Field(f =\> f.AccountName)  
.Query("SOME USER")  
)  
)  
);  
But the result are empty all the time  
if I query another field (instead of AccountName )like source (source of computer name)  
I get result.  
I created a class for the data (and from the properties are from there) :  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/a/8a2b0df7d9222a45b066daca9eb66caccb058ccd.png)

Thanks for help!

---

<div class="post-metadata">

**Author:** ![Henrique\_Mauri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/henrique_mauri/32/61647_2.png) [@Henrique\_Mauri](https://discuss.elastic.co/u/Henrique_Mauri)\
**Post date:** [December 2, 2020, 10:11pm UTC](https://discuss.elastic.co/t/access-elastic-via-net/257116/2 "2020-12-02T22:11:54Z")

</div>

> [@Amit5](#):
>
> Match

Hello Amit

I made some examples of queries on github using NEST in .net core, take a look there if it helps: [GitHub - hgmauri/elasticsearch-with-nest: Example of using Elasticsearch in Docker with the NEST and Serilog nuget package in .NET 7.0](https://github.com/hgmauri/elasticsearch-with-nest)

I believe you can use MatchPhrasePrefix

---

<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:** [December 30, 2020, 10:11pm UTC](https://discuss.elastic.co/t/access-elastic-via-net/257116/3 "2020-12-30T22:11:58Z")

</div>

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