Skip to content

Commit

Permalink
add: opensearch
Browse files Browse the repository at this point in the history
  • Loading branch information
mtfelisb committed Sep 24, 2024
1 parent 555501f commit 1678500
Show file tree
Hide file tree
Showing 10 changed files with 644 additions and 1 deletion.
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

0 comments on commit 1678500

Please sign in to comment.