# Multiple search term on multiple field using wild card

**URL:** <https://discuss.elastic.co/t/multiple-search-term-on-multiple-field-using-wild-card/278790>\
**Category:** Elasticsearch\
**Created:** [July 15, 2021, 1:11pm UTC](https://discuss.elastic.co/t/multiple-search-term-on-multiple-field-using-wild-card/278790 "2021-07-15T13:11:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kurbhatt](https://avatars.discourse-cdn.com/v4/letter/k/5f8ce5/32.png) [@kurbhatt](https://discuss.elastic.co/u/kurbhatt)\
**Post date:** [July 15, 2021, 1:11pm UTC](https://discuss.elastic.co/t/multiple-search-term-on-multiple-field-using-wild-card/278790/1 "2021-07-15T13:11:32Z")

</div>

I have working search for single search on multiple fields and wildcard(using ngram).  
Index creation(s-search index):

```auto
{
  "settings": {
    "number_of_shards": 2,
    "number_of_replicas": 1,
    "index.mapping.coerce": false,
    "analysis": {
      "filter": {
        "ngram_filter": {
          "type": "ngram",
          "min_gram": 3,
          "max_gram": 3
        }
      },
      "analyzer": {
        "ngram_tokenizer_analyzer": {
          "type": "custom",
          "tokenizer": "standard",
          "filter": [
            "lowercase",
            "ngram_filter"
          ]
        }
      }
    }
  },
  "mappings": {
    "dynamic": "strict",
    "properties": {
      "sName": {
        "type": "text",
        "analyzer": "ngram_tokenizer_analyzer",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "source": {
        "type": "text",
        "analyzer": "ngram_tokenizer_analyzer",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "description": {
        "type": "text",
        "analyzer": "ngram_tokenizer_analyzer",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "containerType": {
        "type": "text",
        "analyzer": "ngram_tokenizer_analyzer",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      },
      "comments": {
        "type": "text",
        "analyzer": "ngram_tokenizer_analyzer",
        "fields": {
          "keyword": {
            "type": "keyword",
            "ignore_above": 256
          }
        }
      }
    }
  }
}

```

Here's the query(spring generated):

```auto
{
  "multi_match" : {
    "query" : "str1",
    "fields" : [
      "comments^1.0",
      "containerType^1.0"
      "description^1.0",
      "sName^1.0",
      "source^1.0"
    ],
    "type" : "best_fields",
    "operator" : "OR",
    "slop" : 0,
    "prefix_length" : 0,
    "max_expansions" : 50,
    "zero_terms_query" : "NONE",
    "auto_generate_synonyms_phrase_query" : true,
    "fuzzy_transpositions" : true,
    "boost" : 1.0x
  }
}

```

it is working fine.  
now I want to search multiple terms(with AND clause, both terms should be available in document) on same multi-fields(wildcard using ngram)  
Any suggestion/guidance to achieve this?  
I am trying to use bool but didn't get success yet.

---

<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:** [August 12, 2021, 1:12pm UTC](https://discuss.elastic.co/t/multiple-search-term-on-multiple-field-using-wild-card/278790/2 "2021-08-12T13:12:07Z")

</div>

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