aws-appsync-community icon indicating copy to clipboard operation
aws-appsync-community copied to clipboard

How to perform Suggester Auto completion in AppSync

Open ygag-ameer opened this issue 1 year ago • 0 comments

Hi Team, How to perform suggester query in AppSync with Amazon OpenSearch Service Resolvers. it is perfectly ok with when running search queries. but in the case of the suggester, it failed with some error. The main thing is my completion field is like name.suggest. so, in the name field I want to perform both search and suggestion. it is ok with the search query.

eg:

{
    "version":"2017-02-28",
    "operation":"GET",
    "path":"/brand_search/_search",
    "params":{
        "headers":{},
        "queryString":{},
        "body":{
            "from":0,
            "size":50,
            "query":{
                "term" :{
                    "name": $util.toJson($context.arguments.name)
                }
            }
        }
    }
}

But, when I try to perform the suggester query it failed with some error.

{
    "version":"2017-02-28",
    "operation":"GET",
    "path":"/brand_search/_search",
    "params":{
        "headers":{},
        "queryString":{},
        "body":{
            "from":0,
            "size":50,
            "query":{
                "suggest": {
                  "autocomplete": {
                    "prefix": $util.toJson($context.arguments.name),
                    "completion": {
                      "field": "name.suggest"
                    }
                  }
                }
            }
        }
    }
}

So, here I am looking for some examples related to implementing suggesters and highlighting in AppSync with OpenSearch.

ygag-ameer avatar Aug 01 '22 09:08 ygag-ameer