Skip to content

Commit e128c9e

Browse files
Merge pull request #3 from compliance-innovations/feature/support-opensearch-2
Support OpenSearch 2 by removing deprecated mapping types
2 parents 3ad0a17 + 958e538 commit e128c9e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+151
-452
lines changed

.github/workflows/2.4.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ jobs:
2525
sudo sysctl -w vm.swappiness=1
2626
sudo sysctl -w fs.file-max=262144
2727
sudo sysctl -w vm.max_map_count=262144
28-
- uses: opensearch-project/opensearch-ruby/.github/actions/opensearch@1.x
28+
- uses: opensearch-project/opensearch-ruby/.github/actions/opensearch@main
2929
with:
30-
cluster-version: 1
30+
cluster-version: 2
3131
- uses: ruby/setup-ruby@v1
3232
with:
3333
ruby-version: 2.4

.github/workflows/2.5.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ jobs:
2525
sudo sysctl -w vm.swappiness=1
2626
sudo sysctl -w fs.file-max=262144
2727
sudo sysctl -w vm.max_map_count=262144
28-
- uses: opensearch-project/opensearch-ruby/.github/actions/opensearch@1.x
28+
- uses: opensearch-project/opensearch-ruby/.github/actions/opensearch@main
2929
with:
30-
cluster-version: 1
30+
cluster-version: 2
3131
- uses: ruby/setup-ruby@v1
3232
with:
3333
ruby-version: 2.5

.github/workflows/2.6.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ jobs:
2525
sudo sysctl -w vm.swappiness=1
2626
sudo sysctl -w fs.file-max=262144
2727
sudo sysctl -w vm.max_map_count=262144
28-
- uses: opensearch-project/opensearch-ruby/.github/actions/opensearch@1.x
28+
- uses: opensearch-project/opensearch-ruby/.github/actions/opensearch@main
2929
with:
30-
cluster-version: 1
30+
cluster-version: 2
3131
- uses: ruby/setup-ruby@v1
3232
with:
3333
ruby-version: 2.6

.github/workflows/2.7.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ jobs:
2525
sudo sysctl -w vm.swappiness=1
2626
sudo sysctl -w fs.file-max=262144
2727
sudo sysctl -w vm.max_map_count=262144
28-
- uses: opensearch-project/opensearch-ruby/.github/actions/opensearch@1.x
28+
- uses: opensearch-project/opensearch-ruby/.github/actions/opensearch@main
2929
with:
30-
cluster-version: 1
30+
cluster-version: 2
3131
- uses: ruby/setup-ruby@v1
3232
with:
3333
ruby-version: 2.7

.github/workflows/jruby.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ jobs:
2525
sudo sysctl -w vm.swappiness=1
2626
sudo sysctl -w fs.file-max=262144
2727
sudo sysctl -w vm.max_map_count=262144
28-
- uses: opensearch-project/opensearch-ruby/.github/actions/opensearch@1.x
28+
- uses: opensearch-project/opensearch-ruby/.github/actions/opensearch@main
2929
with:
30-
cluster-version: 1
30+
cluster-version: 2
3131
- uses: ruby/setup-ruby@v1
3232
with:
3333
ruby-version: jruby-9.3

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.0
2+
3+
* Support OpenSearch 2 by removing deprecated type and include_type_name parameters
4+
15
## 0.1.1
26

37
* Pin opensearch-ruby to '~> 1.1' because OpenSearch 2 is not supported yet

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
source 'https://rubygems.org'
1919

2020
gem "rake", "~> 12"
21-
gem "opensearch-ruby", '~> 1.0'
21+
gem "opensearch-ruby", '~> 2.0'
2222
gem "pry"
2323
gem "ansi"
2424
gem "cane"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ The libraries are compatible with Ruby 2.4 and higher.
4343

4444
We follow Ruby’s own maintenance policy and officially support all currently maintained versions per [Ruby Maintenance Branches](https://www.ruby-lang.org/en/downloads/branches/).
4545

46-
The version numbers follow the OpenSearch major versions. Currently the `main` branch is compatible with version `1.x` of the OpenSearch stack.
46+
The version numbers follow the OpenSearch major versions. Currently the `main` branch is compatible with version `2.x` of the OpenSearch stack.
4747

4848
| Rubygem | | OpenSearch |
4949
|:-------------:|:-:| :-----------: |
50-
| main || 1.x |
50+
| main || 2.x |
5151

5252
## Usage
5353

opensearch-model/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The library version numbers follow the OpenSearch major versions. The `main` bra
1212

1313
| Rubygem | | OpenSearch |
1414
|:-------------:|:-:| :-----------: |
15-
| main || 1.x |
15+
| main || 2.x |
1616

1717
## Installation
1818

@@ -523,10 +523,10 @@ class Indexer
523523
case operation.to_s
524524
when /index/
525525
record = Article.find(record_id)
526-
Client.index index: 'articles', type: 'article', id: record.id, body: record.__opensearch__.as_indexed_json
526+
Client.index index: 'articles', id: record.id, body: record.__opensearch__.as_indexed_json
527527
when /delete/
528528
begin
529-
Client.delete index: 'articles', type: 'article', id: record_id
529+
Client.delete index: 'articles', id: record_id
530530
rescue OpenSearch::Transport::Transport::Errors::NotFound
531531
logger.debug "Article not found, ID: #{record_id}"
532532
end

opensearch-model/examples/activerecord_article.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ class Article < ActiveRecord::Base
6464

6565
client.indices.delete index: 'articles' rescue nil
6666
client.bulk index: 'articles',
67-
type: 'article',
6867
body: Article.all.as_json.map { |a| { index: { _id: a.delete('id'), data: a } } },
6968
refresh: true
7069

0 commit comments

Comments
 (0)