# ElasticSearch Search-as-you-type field type field with partial search

**URL:** <https://discuss.elastic.co/t/elasticsearch-search-as-you-type-field-type-field-with-partial-search/284627>\
**Category:** Elasticsearch\
**Created:** [September 20, 2021, 1:35pm UTC](https://discuss.elastic.co/t/elasticsearch-search-as-you-type-field-type-field-with-partial-search/284627 "2021-09-20T13:35:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jacques\_du\_Plessis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jacques_du_plessis/32/35413_2.png) [@Jacques\_du\_Plessis](https://discuss.elastic.co/u/Jacques_du_Plessis)\
**Post date:** [September 20, 2021, 1:35pm UTC](https://discuss.elastic.co/t/elasticsearch-search-as-you-type-field-type-field-with-partial-search/284627/1 "2021-09-20T13:35:15Z")

</div>

I recently updating my ngram implementation settings to use Search-as-you-type field type.

> **[Search-as-you-type field type | Elasticsearch Guide \[7.x\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.x/search-as-you-type.html)**

This worked great but I noticed that partial searching does not work. If I search for number 00060434 I get the desired result but I would also like to be able to search for 60434, then it should return document 3.

Is there a way todo it with the **Search-as-you-type field type** or can i only do this with ngrams?

```auto
PUT searchasyoutype_example
{
  "settings": {
    "analysis": {
      "analyzer": {
        "englishAnalyzer": {
          "tokenizer": "standard",
          "filter": [
            "lowercase",
            "trim",
            "ascii_folding"
          ]
        }
      },
      "filter": {
        "ascii_folding": {
          "type": "asciifolding",
          "preserve_original": true
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "number": {
        "type": "search_as_you_type",
        "analyzer": "englishAnalyzer"
      },

      "fullName": {
        "type": "search_as_you_type",
        "analyzer": "englishAnalyzer"
      }
    }
  }
}

PUT searchasyoutype_example/_doc/1
{
  "number" : "00069794",
  "fullName": "Employee 1"
}

PUT searchasyoutype_example/_doc/2
{
  "number" : "00059840",
  "fullName": "Employee 2"
}

PUT searchasyoutype_example/_doc/3
{
  "number" : "00060434",
  "fullName": "Employee 3"
}

GET searchasyoutype_example/_search
{
  "query": {
    "multi_match": {
      "query": "00060434",
      "type": "bool_prefix",
      "fields": [
        "number",
        "number._index_prefix",
        "fullName",
        "fullName._index_prefix"
      ]
    }
  }
}

```

---

<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 18, 2021, 1:35pm UTC](https://discuss.elastic.co/t/elasticsearch-search-as-you-type-field-type-field-with-partial-search/284627/2 "2021-10-18T13:35:38Z")

</div>

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