# Nest query search with AND

**URL:** <https://discuss.elastic.co/t/nest-query-search-with-and/290793>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [December 2, 2021, 4:08pm UTC](https://discuss.elastic.co/t/nest-query-search-with-and/290793 "2021-12-02T16:08:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Katgust](https://avatars.discourse-cdn.com/v4/letter/k/c4cdca/32.png) [@Katgust](https://discuss.elastic.co/u/Katgust)\
**Post date:** [December 2, 2021, 4:08pm UTC](https://discuss.elastic.co/t/nest-query-search-with-and/290793/1 "2021-12-02T16:08:15Z")

</div>

I'd like to convert this

```auto
GET /financialfirms/_search?q="Danske" AND "Bank"

```

into DSL but can't find out how. Anyone wanna help?

Right now every query I've made gives a result for "Danske" OR "Bank". I've tried different kind of querys and analyzers but I don't get it.

My solution (thats not working correctly) looks like this

```auto
        public ElasticClient EsClient()
        {
            var uri = new Uri("http://localhost:9200");
            var pool = new SingleNodeConnectionPool(uri);
            var settings = new ConnectionSettings(pool).DefaultIndex("financialfirms");
            var client = new ElasticClient(settings);
            return client;
        }

```

```auto
public async Task<GenericResponse<FinancialFirmDto>> GetFinancialFirmByNameES(string name)
        {
          var searchResponse = await EsClient().SearchAsync<FinancialFirmDto>(s => s                
                .Query(q => q
                    .Match(m => m
                      .Field(f => f.Name)
                      .Query(name)
                  )));
        ...
        }

```

**Edit**  
Also, forgot to mention, the input will not be set to specific words like “Danske” and “Bank”, they are just existing examples. The input is user defined (full-text search I guess) and could be any words and amount , so I can’t really use a bool query with terms (what I can tell)

---

<div class="post-metadata">

**Author:** ![vincenbr](https://avatars.discourse-cdn.com/v4/letter/v/8edcca/32.png) [@vincenbr](https://discuss.elastic.co/u/vincenbr)\
**Post date:** [December 2, 2021, 9:55pm UTC](https://discuss.elastic.co/t/nest-query-search-with-and/290793/2 "2021-12-02T21:55:51Z")

</div>

You can specify the operator for the combination of query terms in a match (by default it's OR as you observed ). Add inside the Match  
`.Operator(Operator.And)`

---

<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, 2021, 9:56pm UTC](https://discuss.elastic.co/t/nest-query-search-with-and/290793/3 "2021-12-30T21:56:13Z")

</div>

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