# Create autocomplete query

**URL:** <https://discuss.elastic.co/t/create-autocomplete-query/332693>\
**Category:** Elasticsearch\
**Created:** [May 6, 2023, 5:22am UTC](https://discuss.elastic.co/t/create-autocomplete-query/332693 "2023-05-06T05:22:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Khaled\_Omara](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/khaled_omara/32/120716_2.png) [@Khaled\_Omara](https://discuss.elastic.co/u/Khaled_Omara)\
**Post date:** [May 6, 2023, 5:22am UTC](https://discuss.elastic.co/t/create-autocomplete-query/332693/1 "2023-05-06T05:22:52Z")

</div>

Here is my indices mapping:

```auto
{
  "mappings": {
    "properties": {
      "categories": {
        "type": "text",
        "analyzer": "standard"
      },
      "color": {
        "type": "text",
        "analyzer": "standard"
      },
      "description": {
        "type": "text",
        "analyzer": "standard"
      },
      "entity_id": {
        "type": "long"
      },
      "image": {
        "type": "keyword"
      },
      "is_salable": {
        "type": "long"
      },
      "manufacturer": {
        "type": "text",
        "analyzer": "standard"
      },
      "name": {
        "type": "text",
        "fields": {
          "autocomplete": {
            "type": "text",
            "analyzer": "name_autocomplete",
            "search_analyzer": "name"
          },
          "completion": {
            "type": "completion",
            "analyzer": "simple",
            "preserve_separators": true,
            "preserve_position_increments": true,
            "max_input_length": 50
          },
          "name": {
            "type": "text",
            "analyzer": "worddelimiter_analyzer",
            "search_analyzer": "name"
          }
        }
      },
      "old_price": {
        "type": "double"
      },
      "price": {
        "type": "double"
      },
      "product_link": {
        "type": "keyword"
      },
      "ram_rom": {
        "type": "text",
        "analyzer": "standard"
      },
      "short_description": {
        "type": "text",
        "analyzer": "standard"
      },
      "sku": {
        "type": "keyword"
      },
      "small_image": {
        "type": "keyword"
      },
      "special_price": {
        "type": "double"
      },
      "url_key": {
        "type": "text",
        "analyzer": "standard"
      },
      "visibility": {
        "type": "long"
      }
    }
  }
}

```

I need a query to get auto-complete: example query text: "opp", and I need to get "oppo" from the doc name in the mapping.  
I've tried a lot of queries, but I always got the error: Field [name] is not a completion suggest field

Here is some names values in my index:

- Oppo Nokia Bundle (1\* Oppo A54s - 128GB/4GB (Global Version) + 1\* Nokia 5310)
- Oppo Reno9 Pro Plus 5G - 256GB/16GB (Global Version)
- OPPO Reno 7 - 256GB/8GB

---

<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:** [June 3, 2023, 5:23am UTC](https://discuss.elastic.co/t/create-autocomplete-query/332693/2 "2023-06-03T05:23:22Z")

</div>

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