Skip to content

Add OpenSearch Support to Golang Migrate #1175

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SOURCE ?= file go_bindata github github_ee bitbucket aws_s3 google_cloud_storage godoc_vfs gitlab
DATABASE ?= postgres mysql redshift cassandra spanner cockroachdb yugabytedb clickhouse mongodb sqlserver firebird neo4j pgx pgx5 rqlite
DATABASE ?= postgres mysql redshift cassandra spanner cockroachdb yugabytedb clickhouse mongodb sqlserver firebird neo4j pgx pgx5 rqlite opensearch
DATABASE_TEST ?= $(DATABASE) sqlite sqlite3 sqlcipher
VERSION ?= $(shell git describe --tags 2>/dev/null | cut -c 2-)
TEST_FLAGS ?=
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Database drivers run migrations. [Add a new database?](database/driver.go)
* [Firebird](database/firebird)
* [MS SQL Server](database/sqlserver)
* [rqlite](database/rqlite)
* [OpenSearch](database/opensearch)

### Database URLs

Expand Down
18 changes: 18 additions & 0 deletions database/opensearch/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# OpenSearch

* Driver work with OpenSearch through [OpenSearch REST API](https://opensearch.org/docs/latest/getting-started/communicate/#opensearch-rest-api)
* Migrations are written in JSON format and support actions such as creating indices, updating mappings, modifying settings and etc.
* [Examples](./examples)

# Usage

`opensearch://user:password@host:port/index`

| URL Query | Default value | Description |
|------------|---------------------|-------------|
| `index` | `.migrations` | Name of the migrations index |
| `timeout` | `60s` | The max time that an operation will wait before failing. |
| `user` | | The user to sign in as. Can be omitted |
| `password` | | The user's password. Can be omitted |
| `host` | | The host to connect to |
| `port` | | The port to bind to |
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"action": "DELETE /test-index",
"body": {}
}
16 changes: 16 additions & 0 deletions database/opensearch/examples/migrations/1_create_index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"action": "PUT /test-index",
"body": {
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0
},
"mappings": {
"properties": {
"title": {
"type": "text"
}
}
}
}
}
Loading
Loading