Completion Suggesters stopped working with 2.2.0 upgrade

(Marlin Forbes) #1

Hi there,

We've hit an error where a completion suggester which was working before is no longer working. The error thrown is the following:

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

Mapping for suggest-category is as follows:

suggest-category: {
    type: "completion",
    analyzer: "simple",
    payloads: true,
    preserve_separators: true,
    preserve_position_increments: true,
    max_input_length: 50

Query is as follows:

    index: "advertisers-current",
    search_type: "count",
    body: {
        suggest: {
            text: "estate",
            suggest-category: {
                completion: {
                    field: "suggest-category",
                    fuzzy: {
                        fuzziness: 0

The suggest-category field is an array of values.
Any ahem suggestions? The error is pretty cryptic. This works flawlessly on 2.1.1.

(Aluminous) #2

Hi datashaman,

What type are your payloads?

I'm not sure if you're still having this issue, but in my case I saw this error because I was using String payloads. Checking the docs revealed that payloads are "arbitrary JSON objects", so I guess the fact that this worked pre-2.2.0 was a bug.

Changing the payload to a single-property JSON object resolved the error.

(Marlin Forbes) #3

Thanks very much for your help, that solved my problem!

(system) #4