#amplify-count-directive / implementing aggregation

3 messages · Page 1 of 1 (latest)

late wren
#

I ran across an issue while implementing aggregation on one of my pages where I am unable to return the number of items I have in my table, and without the count I can't determine how many pages I should put in the 1,2,3,4... aggregate component

did some research and ran across this link
https://github.com/aws-amplify/amplify-category-api/issues/405
The answer provided by https://github.com/multimeric is exactly what I am looking for
https://github.com/multimeric/AmplifyCountDirective
However, this is an old answer, I do not know if this is implemented by default now...

When I visited https://docs.amplify.aws/vue/build-a-backend/graphqlapi/search-and-result-aggregations/
it says that I have to add "@searchable" directive to a model

for example

type Student @model @searchable {
name: String
dateOfBirth: AWSDate
email: AWSEmail
examsCompleted: Int
}

Assuming that I am using the above model with @auth rules and I already have data in my tables, loads of data, is adding the "@searchable" going to cause issues" ? am I going to lose the data which I already have?

GitHub

Is your feature request related to a problem? Please describe. I think it's way past due that Amplify supports total counts in GraphQL queries. Other GraphQL based platforms has this built in b...

GitHub

Count the number of items in your DynamoDB tables using Amplify - multimeric/AmplifyCountDirective

#

amplify-count-directive / implementing aggregation

drowsy gorge
#

Hi Sting, Adding @searchablewill generate indexes for your data without data loss. However, it's important to note that it won't automatically backfill existing data by default. You'll need to execute the script documented here [https://docs.amplify.aws/vue/build-a-backend/graphqlapi/troubleshooting/#backfill-opensearch-index-from-dynamodb-table] to backfill existing data into the OpenSearch index. Please ensure to verify this in your development environment before proceeding to production.