amplify-category-api icon indicating copy to clipboard operation
amplify-category-api copied to clipboard

OpenSearch: @searchable - wildcard, regexp matching returns 0 results

Open majirosstefan opened this issue 3 years ago • 25 comments

Before opening, please confirm:

JavaScript Framework

React, React Native

Amplify APIs

GraphQL API

Amplify Categories

api

Environment information

# Put output below this line
System:
    OS: macOS 12.1
    CPU: (8) x64 Apple M1 Pro
    Memory: 145.91 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 12.22.10 - ~/.nvm/versions/node/v12.22.10/bin/node
    Yarn: 1.22.17 - ~/.nvm/versions/node/v12.22.10/bin/yarn
    npm: 6.14.16 - ~/.nvm/versions/node/v12.22.10/bin/npm
    Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman
  Browsers:
    Brave Browser: 103.1.40.107
    Chrome: 103.0.5060.114
    Safari: 15.2
  npmPackages:
    @alfonmga/react-lottie-light-ts: ^0.0.1 => 0.0.1 
    @aws-amplify/pushnotification: ^4.3.8 => 4.3.8 
    @babel/core: ^7.8.6 => 7.14.8 (7.17.5, 7.9.0, 7.16.0)
    @cometchat-pro/chat: ^3.0.4 => 3.0.6 
    @cometchat-pro/react-native-chat: 3.0.0 => 3.0.0 
    @expo-google-fonts/inter: ^0.2.0 => 0.2.0 
    @expo/match-media: ^0.3.0 => 0.3.0 
    @expo/webpack-config: ^0.16.6 => 0.16.16 
    @react-native-async-storage/async-storage: ^1.12.1 => 1.15.9 
    @react-native-clipboard/clipboard: ^1.9.0 => 1.9.0 
    @react-native-community/cameraroll: ^4.1.2 => 4.1.2 
    @react-native-community/checkbox: ^0.5.1 => 0.5.8 
    @react-native-community/masked-view: 0.1.10 => 0.1.10 
    @react-native-community/netinfo: 6.0.2 => 6.0.2 
    @react-native-community/push-notification-ios: ^1.8.0 => 1.8.0 (1.0.3)
    @react-native-community/slider: 3.0.3 => 3.0.3 
    @react-native-picker/picker: ^2.1.0 => 2.2.1 
    @react-navigation/bottom-tabs: ^6.0.5 => 6.0.5 
    @react-navigation/drawer: ^6.3.1 => 6.3.1 
    @react-navigation/native: ^6.0.2 => 6.0.2 
    @react-navigation/stack: ^6.0.7 => 6.0.7 
    @sentry/react-native: ^3.2.4 => 3.2.5 
    @storybook/addon-actions: ^6.0.21 => 6.3.6 
    @storybook/addon-knobs: ^6.0.21 => 6.3.0 
    @storybook/addon-ondevice-actions: ^5.3.21 => 5.3.23 
    @storybook/addon-ondevice-knobs: ^5.3.21 => 5.3.25 
    @storybook/react-native: ^5.3.21 => 5.3.25 
    @stripe/react-stripe-js: ^1.7.0 => 1.7.0 
    @stripe/stripe-js: ^1.23.0 => 1.23.0 
    @svgr/webpack: ^5.4.0 => 5.5.0 
    @types/howler: ^2.2.4 => 2.2.4 
    @types/lodash: ^4.14.161 => 4.14.172 
    @types/react: ~16.9.35 => 16.9.56 (17.0.15)
    @types/react-native: ~0.63.2 => 0.63.53 (0.65.1)
    @types/uuid: ^8.3.0 => 8.3.1 
    HelloWorld:  0.0.1 
    amazon-cognito-identity-js: ^4.4.0 => 4.6.3 (5.2.3)
    aws-amplify: ^4.3.11 => 4.3.11 
    aws-amplify-react-native: ^6.0.2 => 6.0.2 
    aws-sdk: ^2.1056.0 => 2.1057.0 
    babel-jest: ~25.2.6 => 25.2.6 (25.5.1)
    babel-loader: ^8.2.3 => 8.2.3 (8.1.0)
    babel-plugin-react-native-web: ^0.17.5 => 0.17.5 (0.13.18)
    buffer: ^6.0.3 => 6.0.3 (4.9.2, 5.7.1)
    dayjs: ^1.9.4 => 1.10.6 
    dotenv-webpack: ^7.1.0 => 7.1.0 
    emoji-mart-native: ^0.6.2-beta => 0.6.2-beta 
    expo: ^39.0.0 => 39.0.5 
    expo-application: ~2.3.0 => 2.3.0 
    expo-av: ^9.2.3 => 9.2.3 
    expo-document-picker: ^9.2.3 => 9.2.4 
    expo-font: ^9.2.1 => 9.2.1 (8.3.0)
    expo-image-picker: ^10.2.2 => 10.2.2 
    expo-linking: 1.0.7 => 1.0.7 
    expo-permissions: ^12.1.1 => 12.1.1 (9.3.0)
    expo-splash-screen: ~0.6.2 => 0.6.2 
    expo-status-bar: ~1.0.2 => 1.0.4 
    expo-updates: ~0.3.2 => 0.3.5 
    faker: 5.5.3 => 5.5.3 
    file-loader: ^6.2.0 => 6.2.0 (6.0.0)
    hermes-inspector-msggen:  1.0.0 
    howler: ^2.2.3 => 2.2.3 
    install: ^0.13.0 => 0.13.0 
    jest: ~25.2.6 => 25.2.7 
    lodash: ^4.17.20 => 4.17.21 
    lottie-react-native: ~2.6.1 => 2.6.1 
    numeral: ^2.0.6 => 2.0.6 
    patch-package: ^6.4.7 => 6.4.7 
    plaid: ^10.1.0 => 10.1.0 
    postinstall-postinstall: ^2.1.0 => 2.1.0 
    prettier: 2.5.1 => 2.5.1 
    query-string: ^7.0.1 => 7.0.1 
    react: 16.13.1 => 16.13.1 (16.14.0)
    react-animated:  0.1.0 
    react-dom: 16.13.1 => 16.13.1 
    react-image-file-resizer: ^0.4.7 => 0.4.7 
    react-is: ^16.13.1 => 16.13.1 
    react-lottie: ^1.2.3 => 1.2.3 
    react-native: ~0.63.4 => 0.63.4 
    react-native-android-keyboard-adjust: ^1.2.0 => 1.2.0 
    react-native-autolink: ^4.0.0 => 4.0.0 
    react-native-blob-courier: 3.0.2 => 3.0.2 
    react-native-config: ^1.4.5 => 1.4.5 
    react-native-device-info: ^8.3.0 => 8.3.1 
    react-native-elements: ^3.4.2 => 3.4.2 
    react-native-fs: ^2.18.0 => 2.18.0 
    react-native-gesture-handler: ^1.10.3 => 1.10.3 
    react-native-get-random-values: ^1.5.0 => 1.7.0 
    react-native-hyperlink: ^0.0.19 => 0.0.19 
    react-native-image-resizer: ^1.4.5 => 1.4.5 
    react-native-keep-awake: ^4.0.0 => 4.0.0 
    react-native-keyboard-aware-scroll-view: https://github.com/APSL/react-native-keyboard-aware-scroll-view#fb40649a9c84aa23d6a55355e9e0e432795967a6 => 0.9.2 
    react-native-mov-to-mp4: ^0.2.2 => 0.2.2 
    react-native-plaid-link-sdk: ^7.2.1 => 7.2.1 
    react-native-portalize: ^1.0.7 => 1.0.7 
    react-native-reanimated: 1.13.2 => 1.13.2 
    react-native-safe-area-context: ^3.3.2 => 3.3.2 (3.1.4)
    react-native-screens: ^3.7.2 => 3.7.2 
    react-native-sound: ^0.11.1 => 0.11.1 
    react-native-svg: 12.1.0 => 12.1.0 
    react-native-svg-transformer: ^0.14.3 => 0.14.3 
    react-native-swipe-list-view: ^3.2.9 => 3.2.9 
    react-native-unimodules: ^0.14.6 => 0.14.6 
    react-native-vector-icons: ^8.1.0 => 8.1.0 
    react-native-web: ~0.17.5 => 0.17.5 
    react-native-webview: ^11.13.0 => 11.13.0 
    react-plaid-link: 3.2.2 => 3.2.2 
    react-responsive: ^9.0.0-beta.6 => 9.0.0-beta.6 
    react-test-renderer: ~16.13.1 => 16.13.1 
    read-excel-file: ^5.3.5 => 5.3.5 
    read-excel-file/commonjs:  undefined ()
    read-excel-file/node:  1.0.0 
    read-excel-file/schema:  1.0.0 
    read-excel-file/web-worker:  1.0.0 
    reanimated-bottom-sheet: ^1.0.0-alpha.22 => 1.0.0-alpha.22 
    rn-fetch-blob: ^0.12.0 => 0.12.0 
    stripe: ^8.135.0 => 8.209.0 
    tipsi-stripe: ^8.0.2 => 8.0.2 
    typescript: ^4.3.2 => 4.5.5 
    url-loader: ^4.1.1 => 4.1.1 
    uuid: ^8.3.2 => 8.3.2 (3.4.0, 3.3.2, 7.0.2, 7.0.3)
    webpack: ^4.43.0 => 4.46.0 (4.43.0)
  npmGlobalPackages:
    @aws-amplify/cli: 5.1.0
    expo-cli: 5.3.0
    npm: 6.14.16
    yarn: 1.22.17

Describe the bug

Running this code gives me zero results (Index contains data).

I am running app on iOS & Android simulator. I get the same response even when I am running react-native in web environment.

I am using "ElasticSearchInstanceType": "t2.small.elasticsearch".

I would expect it returned something back.

  • EDIT The same happens for regexp with payload "Lo" or "\Lo\" or "*Lo*".
  • EDIT2: (Searchable) Data were imported after creating table with @searchable annotation using NodeJS, Dynamo Document Client and its PutOperation.
 const variables: SearchSchoolsQueryVariables = {
      filter:  {
        schoolName: {            
          wildcard: "*Lo*"
        },
      },
    };

 const response = (await API.graphql(
      graphqlOperation(searchSchools, variables)
    )) as GraphQLResult<SearchSchoolsQuery>;
    

schema.graphql:

type School
  @model(subscriptions: null)
  @auth(
    rules: [
      { allow: private, operations: [read] }
      { allow: public, operations: [read] }
    ]
  )
  @key(
    name: "schoolsByName"
    fields: ["schoolName"]
    queryField: "allSchoolsByName"
  )
  @searchable
  {
  id: ID!  
  schoolName: String!
  createdAt: AWSDateTime!
  updatedAt: AWSDateTime!
}

Expected behavior

It would return non-empty response.

Reproduction steps

Run the search & add dummy data.

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

Web, iOS, Android

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

majirosstefan avatar Jul 07 '22 16:07 majirosstefan