Skip to content

CompletionSuggester not working because prefix is placed at wrong position in JSON #150

Closed
@Lenoirio

Description

@Lenoirio

I'm migrating from the old high-level-client and I'm having an issue with the CompletionSuggester (using 7.16.3 right now)

As the doc at https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html states, a request looks like this

POST music/_search?pretty
{
  "suggest": {
    "song-suggest": {
      "prefix": "nir",        
      "completion": {         
          "field": "suggest"  
      }
    }
  }
}

As you can see the prefix is placed in front of the "completion"-object. When I use your CompletionSuggester it will place the prefix inside the "completion"-object. As a result ElasticSearch gives me this error:

[2022-02-01T14:26:53,829][ERROR][c.a.e.AuthenticationPlugin] [SAG-21X1703] org.elasticsearch.xcontent.XContentParseException: [1:257] [completion] unknown field [prefix]

Am I doing something wrong or is this a bug? The old java-client was doing it right and also placed the prefix in front of the "completion"-object.

Thank you very much!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions