aws-amplify / aws-amplify/amplify-cli
(gen2-migration) `@searchable` schema directive
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 825
- Avg merge
- 11d 23h
- Merged PRs (30d)
- 2
Description
### Is this feature request related to a new or existing Amplify category?
_No response_
### Is this related to another service?
_No response_
### Describe the feature you'd like to request
Gen1 schemas offer a `@searchable` directive:
```graphql
type Post @model @searchable {
id: ID!
title: String!
createdAt: String!
updatedAt: String!
upvotes: Int
}
```
Internally, this directive creates and configures an OpenSearch domain that provides fast search capabilities.
We'd like for customers to retain this capability moving to Gen2.
### Describe the solution you'd like
In Gen2, there is not direct support for the `@searchable` directive. The same functionality can be achieved though by writing CDK code.
> See https://docs.amplify.aws/react/build-a-backend/data/custom-business-logic/search-and-aggregate-queries/
Supporting this directive means:
1. Fetch the Gen1 OpenSearch domain definition and code generate it in Gen2. The domain alone is not sufficient though, we need to follow the guide and figure out which resources need to code generated.
2. Since OpenSearch domains are stateful resources, we also need to refactor it.
### Describe alternatives you've considered
None
### Additional context
There are still a few open questions:
1. What will the `@searchable` directive do when consumed by the Gen2 data construct? ignored? fail?
2. Does the provided guide also fit the migration use-case where the same domain is being used?
### Is this something that you'd be interested in working on?
- [ ] 👋 I may be able to implement this feature request
### Would this feature include a breaking change?
- [ ] ⚠️ This feature might incur a breaking change
Contributor guide
Assessment
This issue has not been assessed yet.