# Match exact phrase using elasticsearch Nest

**URL:** <https://discuss.elastic.co/t/match-exact-phrase-using-elasticsearch-nest/322412>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [January 4, 2023, 2:24am UTC](https://discuss.elastic.co/t/match-exact-phrase-using-elasticsearch-nest/322412 "2023-01-04T02:24:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Javier\_Zaldivar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javier_zaldivar/32/98140_2.png) [@Javier\_Zaldivar](https://discuss.elastic.co/u/Javier_Zaldivar)\
**Post date:** [January 4, 2023, 2:24am UTC](https://discuss.elastic.co/t/match-exact-phrase-using-elasticsearch-nest/322412/1 "2023-01-04T02:24:47Z")

</div>

I'm using Nest to build a query. I have a class called Event which has a property called Location and a property called Address (a string). So the indices look something like this:

```auto
"id" : "something1",
"location": {
    "address": "The Club",
}

"id" : "something2",
"location": {
    "address": "The Hole",
}

```

I want to create a query where the user types "The Club" (the location variable) and it only retrieves the first item that has "The Club" as the address

This is my current query

```auto
 var skip = (page - 1) * rows;
  var searchResponse = await _elasticClient.SearchAsync<Event>(s => s
            .From(skip)
            .Size(rows)
            .Query(q => q
                .QueryString(qs => qs
                    .Fields(fields => fields
                        .Field(f => f.Location.Address)
                    )
                    .Analyzer("keyword")
                    .Query("*" + (location ?? string.Empty) + "*")
                )
            ));

```

Currently, the query retrieves both objects since it finds "The". Do I need to add something to my index previously or what should I do?

---

<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:** [February 1, 2023, 2:25am UTC](https://discuss.elastic.co/t/match-exact-phrase-using-elasticsearch-nest/322412/2 "2023-02-01T02:25:08Z")

</div>

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