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
search 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
If you are using AppSync with
Amplify CLI
,@searchable
will automatically create the followings: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
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.
caching
Caching behavior
is set toNone
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.
Advanced cluster settings
and ensure the attributeFielddata cache allocation
is set to0
Fielddata cache allocation
is not 0, update the cluster configuration and modify the advanced cluster setting to set theFielddata cache allocation
field to0
.Wait for a few minutes (I would suggest 5 minutes) and then retry your use-case.
I hope this would help resolve your issue.