skip to Main Content

I deleted all the items in the DataTemplate table but when I query them again with the searchDataTemplates endpoint on the app or in AppSync it returns the old data, but when I use the listDataTemplates it returns nothing which is correct. Needed to repopulate the data in the table.

data template table

data template table

search endpoint

search endpoint

list endpoint

list endpoint

when I updated items individually it worked just fine but when i deleted all the items from the console (around 700 items) the search endpoint stopped working. Just the search

UPDATE:

I repopulated the data hoping it’d reset but now the listDataTemplates shows the new data and the search still shows the old data, is there some cache that needs to be reset?

SECOND UPDATE:

I removed the table and the appsync functions are gone however when i recreated the table (with no data) the testing out the function still returns the old data. I’m guessing the opensearch stuff hasn’t been updated?

2

Answers


  1. If you are using AppSync with Amplify CLI, @searchable will automatically create the followings:

    1. An OpenSearch Domain
    2. A Lambda Function that will be attached to the DynamoDB Streams and push the changes (create/update/delete) over to your OpenSearch Domain.

    And the problem that you’re facing is most likely due to the Lambda Function created failed to push the changes from DynamoDB Streams to OpenSearch. A quick suggestion is to check on the created Lambda Function first.

    Reference: @searchable

    Login or Signup to reply.
  2. This issue can only happen if caching is enabled in your application.

    I am not sure what’s the infrastructure you are using, so i would go ahead with some educated guess. Please feel free to correct me if i overstepped.

    From your description of question, you have an AppSync as API layer and DynamoDb as primary database.

    If these are the only two resources you have, please check the AppSync cache configuration.

    • Open AppSync console
    • from left panel select APIs -> your api -> caching
    • Validate Caching behavior is set to None

    In case if you have AWS OpenSearch enabled for search query (i could be wrong, however picking up from previous comment). Then validate the cluster configuration.

    • Open AWS Open Search Service console
    • From left panel select Domains and click on the openserch domain that you are using
    • scroll to the bottom right and look for Advanced cluster settings and ensure the attribute Fielddata cache allocation is set to 0
      • If Fielddata cache allocation is not 0, update the cluster configuration and modify the advanced cluster setting to set the Fielddata cache allocation field to 0.

    Wait for a few minutes (I would suggest 5 minutes) and then retry your use-case.


    I hope this would help resolve your issue.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search