Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

appsync amplify filter using multiMatch example

Im experimenting with Amplify and Appsync graphql implementation using AWSAppSyncClient, and was trying to implement a rudimentary search on multiple fields, using 'and' operator for multiple key-words.

EG; Fetch any entries where specified fields contain "red" and "car"... such as, title could have car, and description could have the word red in it, and vice versa.

This requires either nested and/or filters, or im guessing using the multiMatch filter. I am unable to find any docs or examples for such a search.

So, my question is, is what I'm trying to do possible with amplify appsync client? And is there any example(or documentation) on how @searchable directive with multiMatch search works?

like image 894
Fahad Avatar asked Nov 07 '22 20:11

Fahad


1 Answers

There is a multi_match example at the bottom of this page.

"body":{
    "from":0,
    "size":50,
    "query" : {
        "multi_match" : {
            "query" : "$context.arguments.state",
            "fields" : ["city", "state"]
        }
    }
}
like image 70
Fook Avatar answered Nov 15 '22 05:11

Fook