Create autocomplete query

Here is my indices mapping:

{
  "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

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