Reputation: 61
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?
Upvotes: 1
Views: 708
Reputation: 61
I after a while I finally got it work. I ended up creating an item with the same id and deleted it right after. After trying it in AppSync I created a script to create and delete all the ids that were coming back from the searchQuery instead of doing it one by one in AppSync console.
Upvotes: 0
Reputation: 568
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 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.
Advanced cluster settings
and ensure the attribute Fielddata cache allocation
is set to 0
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.
Upvotes: 2
Reputation: 246
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
Upvotes: 1