# \[ES 2.2.0\] Autocomplete Suggester throwing illegal argument exception

**URL:** <https://discuss.elastic.co/t/es-2-2-0-autocomplete-suggester-throwing-illegal-argument-exception/45288>\
**Category:** Elasticsearch\
**Created:** [March 23, 2016, 11:11pm UTC](https://discuss.elastic.co/t/es-2-2-0-autocomplete-suggester-throwing-illegal-argument-exception/45288 "2016-03-23T23:11:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![raunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raunak/32/4446_2.png) [@raunak](https://discuss.elastic.co/u/raunak)\
**Post date:** [March 23, 2016, 11:11pm UTC](https://discuss.elastic.co/t/es-2-2-0-autocomplete-suggester-throwing-illegal-argument-exception/45288/1 "2016-03-23T23:11:29Z")

</div>

I'm using ElasticSearch 2.2.0.

When I execute suggestion query against my index, I get a

`{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Can't write raw bytes whose xcontent-type can't be guessed"}],"type":"illegal_argument_exception","reason":"Can't write raw bytes whose xcontent-type can't be guessed"},"status":400}`

I'm doing a HTTP POST request (via Postman, also tried via curl with -X POST option) to [http://localhost:9200/ind/\_suggest](http://localhost:9200/ind/_suggest)

```
{
  "ind" : {
    "text" : "att",
    "completion" : {
      "field" : "product_suggest"
    }
  }
}

```

My mapping is configured as follows:

```
 "mappings" : {
        "product": {
            "properties": {
                "dateCreated": {
                    "type": "date",
                    "format": "strict_date_optional_time||epoch_millis"
                },
                "name": {
                    "type": "string",
                    "index": "not_analyzed"
                },
                "product_suggest": {
                    "type": "completion",
                    "analyzer": "simple",
                    "payloads": true,
                    "preserve_separators": true,
                    "preserve_position_increments": true,
                    "max_input_length": 50
                }
            }
        }
    }
}

```

Any ideas why this is happening? ES doesn't throw the error if I enter a gibberish term in the 'text' field.

---

<div class="post-metadata">

**Author:** ![raunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raunak/32/4446_2.png) [@raunak](https://discuss.elastic.co/u/raunak)\
**Post date:** [March 23, 2016, 11:45pm UTC](https://discuss.elastic.co/t/es-2-2-0-autocomplete-suggester-throwing-illegal-argument-exception/45288/2 "2016-03-23T23:45:36Z")

</div>

Changed payload type from String to JSON object and everything started working. Phew 🙂

---

<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:** [July 5, 2017, 11:05pm UTC](https://discuss.elastic.co/t/es-2-2-0-autocomplete-suggester-throwing-illegal-argument-exception/45288/3 "2017-07-05T23:05:40Z")

</div>


