# Search multiple fields using multiple text values

**URL:** https://discuss.elastic.co/t/search-multiple-fields-using-multiple-text-values/314903
**Category:** Elasticsearch
**Tags:** docker
**Created:** [September 21, 2022, 10:38pm UTC](https://discuss.elastic.co/t/search-multiple-fields-using-multiple-text-values/314903 "2022-09-21T22:38:43Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![sadiki-dev](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@sadiki-dev](https://discuss.elastic.co/u/sadiki-dev)
#### Post date: [September 21, 2022, 10:38pm UTC](https://discuss.elastic.co/t/search-multiple-fields-using-multiple-text-values/314903/1 "2022-09-21T22:38:43Z")

</div>

I work with address searching. and I want to search with two formats (multiple values) of an adress using multiple fields. adress is a text input not a keyword.

For example :  
user\_address = 88 South East Street Raeford, NC 28376  
formated\_address = 88 SE ST Raeford, NC 28376

and I want to search with theses two values using field\_1 and field\_2.

This appoach worked for specif value/keyword like ids. but didn't work for text values like address

```json
{
  "query": {
    "match": {
      "id": {
        "query": "111111 22222",
        "operator": "or"
      }
    }
  }
}

```

I tried using bool with must , but did'nt work because must like AND , and if one is false, will return nothing ; something like this :

```json
{
  "query": {
    "bool": {
      "must": [
        {"match": {"field_1": "88 South East Street Raeford, NC 28376"}},
        {"match": {"field_2": "88 SE ST Raeford, NC 28376"}}
      ]
    }
  }
}

```

I tried using should, but give me more results and not specific results, that exactly match the required solutions.

I know that we can use match\_multiple with multiple fields. Can I use it for multiple values ? if yes, How ?

Please who has any ideas, how to fix this issues, or any out of boxes ideas.  
Thanks.

---

<div class="post-metadata">

### Author: ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)
#### Post date: [September 22, 2022, 12:56am UTC](https://discuss.elastic.co/t/search-multiple-fields-using-multiple-text-values/314903/2 "2022-09-22T00:56:23Z")

</div>

Hi, try "should" clause of [boolean query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html), not "must" clause. In addition, take care about the default [minimum\_should\_match](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html#bool-min-should-match) setting if you use the should clause with other clauses.

```auto
{
  "query": {
    "bool": {
      "should": [
        {"match": {"field_1": "88 South East Street Raeford, NC 28376"}},
        {"match": {"field_2": "88 SE ST Raeford, NC 28376"}}
      ]
    }
  }
}

```

---

<div class="post-metadata">

### Author: ![joao](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joao/32/83447_2.png) [@joao](https://discuss.elastic.co/u/joao)
#### Post date: [September 22, 2022, 1:28am UTC](https://discuss.elastic.co/t/search-multiple-fields-using-multiple-text-values/314903/3 "2022-09-22T01:28:50Z")

</div>

Hello,

Did you read about Disjunction max query? I think that can help you.

```auto
GET /_search
{
  "query": {
    "dis_max": {
      "queries": [
        { "term": { "title": "Quick pets" } },
        { "term": { "body": "Quick pets" } }
      ],
      "tie_breaker": 0.7
    }
  }
}

```

Documentation: [Disjunction max query | Elasticsearch Guide [8.4] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-dis-max-query.html#query-dsl-dis-max-query-ex-request)

---

<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: [October 20, 2022, 1:29am UTC](https://discuss.elastic.co/t/search-multiple-fields-using-multiple-text-values/314903/4 "2022-10-20T01:29:45Z")

</div>

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