[ES 2.2.0] Autocomplete Suggester throwing illegal argument exception


(Raunak) #1

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

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


(Raunak) #2

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


(system) #3