Skip to content

Commit 5411782

Browse files
committed
[DOCS] Updates READMEs
1 parent 18fa01d commit 5411782

File tree

4 files changed

+41
-69
lines changed

4 files changed

+41
-69
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ repository = Elasticsearch::Persistence::Repository.new
109109

110110
repository.save Article.new(title: 'Test')
111111
# POST http://localhost:9200/repository/article
112-
# => {"_index"=>"repository", "_type"=>"article", "_id"=>"Ak75E0U9Q96T5Y999_39NA", ...}
112+
# => {"_index"=>"repository", "_id"=>"Ak75E0U9Q96T5Y999_39NA", ...}
113113
```
114114

115115
**Please refer to each library documentation for detailed information and examples.**
@@ -164,9 +164,9 @@ This software is licensed under the Apache 2 license, quoted below.
164164
the Apache License, Version 2.0 (the "License"); you may
165165
not use this file except in compliance with the License.
166166
You may obtain a copy of the License at
167-
167+
168168
http://www.apache.org/licenses/LICENSE-2.0
169-
169+
170170
Unless required by applicable law or agreed to in writing,
171171
software distributed under the License is distributed on an
172172
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

elasticsearch-model/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ It aims to simplify integration of Ruby classes ("models"), commonly found e.g.
88

99
This library is compatible with Ruby 3 and higher.
1010

11-
The version numbers follow the Elasticsearch major versions. Currently the `main` branch is compatible with version `7.x` of the Elasticsearch stack. **We haven't tested and updated the code for Elasticsearch `8.0` yet**.
11+
The version numbers follow the Elasticsearch major versions. Currently the `main` branch is compatible with version `8.x` of the Elasticsearch stack.
1212

1313
| Rubygem | | Elasticsearch |
1414
|:-------:|:-:|:-------------:|
@@ -141,7 +141,7 @@ Elasticsearch::Model.client = Elasticsearch::Client.new log: true
141141
You might want to do this during your application bootstrap process, e.g. in a Rails initializer.
142142

143143
Please refer to the
144-
[`elasticsearch-transport`](https://github.com/elastic/elasticsearch-ruby/tree/main/elasticsearch-transport)
144+
[`elastic-transport`](https://github.com/elastic/elastic-transport-ruby/)
145145
library documentation for all the configuration options, and to the
146146
[`elasticsearch-api`](http://rubydoc.info/gems/elasticsearch-api) library documentation
147147
for information about the Ruby client API.

elasticsearch-persistence/README.md

Lines changed: 23 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@ Persistence layer for Ruby domain objects in Elasticsearch, using the Repository
44

55
## Compatibility
66

7-
This library is compatible with Ruby 2.4 and higher.
7+
This library is compatible with Ruby 3.1 and higher.
88

9-
The version numbers follow the Elasticsearch major versions. Currently the `main` branch is compatible with version `7.x` of the Elasticsearch stack. **We haven't tested and updated the code for Elasticsearch `8.0` yet**.
9+
The version numbers follow the Elasticsearch major versions. Currently the `main` branch is compatible with version `8.x` of the Elasticsearch stack.
1010

11-
| Rubygem | | Elasticsearch |
12-
|:-------------:|:-:| :-----------: |
13-
| 0.1 || 1.x |
14-
| 2.x || 2.x |
15-
| 5.x || 5.x |
16-
| 6.x || 6.x |
17-
| 7.x || 7.x |
18-
| main || 7.x |
11+
| Rubygem | | Elasticsearch |
12+
|:-------:|:-:|:-------------:|
13+
| 0.1 || 1.x |
14+
| 2.x || 2.x |
15+
| 5.x || 5.x |
16+
| 6.x || 6.x |
17+
| 7.x || 7.x |
18+
| 8.x || 8.x |
19+
| main || 8.x |
1920

2021
## Installation
2122

@@ -78,15 +79,15 @@ note = Note.new id: 1, text: 'Test'
7879
repository.save(note)
7980
# PUT http://localhost:9200/repository/_doc/1 [status:201, request:0.210s, query:n/a]
8081
# > {"id":1,"text":"Test"}
81-
# < {"_index":"repository","_type":"note","_id":"1","_version":1,"created":true}
82+
# < {"_index":"repository","_id":"1","_version":1,"created":true}
8283
```
8384

8485
...find it...
8586

8687
```ruby
8788
n = repository.find(1)
8889
# GET http://localhost:9200/repository/_doc/1 [status:200, request:0.003s, query:n/a]
89-
# < {"_index":"repository","_type":"note","_id":"1","_version":2,"found":true, "_source" : {"id":1,"text":"Test"}}
90+
# < {"_index":"repository","_id":"1","_version":2,"found":true, "_source" : {"id":1,"text":"Test"}}
9091
=> <Note:0x007fcbfc0c4980 @attributes={"id"=>1, "text"=>"Test"}>
9192
```
9293

@@ -105,14 +106,14 @@ repository.search(query: { match: { text: 'test' } }).first
105106
```ruby
106107
repository.delete(note)
107108
# DELETE http://localhost:9200/repository/_doc/1 [status:200, request:0.014s, query:n/a]
108-
# < {"found":true,"_index":"repository","_type":"note","_id":"1","_version":3}
109-
=> {"found"=>true, "_index"=>"repository", "_type"=>"note", "_id"=>"1", "_version"=>2}
109+
# < {"found":true,"_index":"repository","_id":"1","_version":3}
110+
=> {"found"=>true, "_index"=>"repository", "_id"=>"1", "_version"=>2}
110111
```
111112

112113
The repository module provides a number of features and facilities to configure and customize the behavior:
113114

114115
* Configuring the Elasticsearch [client](https://github.com/elastic/elasticsearch-ruby#usage) being used
115-
* Setting the index name, document type, and object class for deserialization
116+
* Setting the index name, and object class for deserialization
116117
* Composing mappings and settings for the index
117118
* Creating, deleting or refreshing the index
118119
* Finding or searching for documents
@@ -145,16 +146,15 @@ class MyRepository
145146
end
146147

147148
client = Elasticsearch::Client.new(url: ENV['ELASTICSEARCH_URL'], log: true)
148-
repository = MyRepository.new(client: client, index_name: :my_notes, type: :note, klass: Note)
149+
repository = MyRepository.new(client: client, index_name: :my_notes, klass: Note)
149150
repository.settings number_of_shards: 1 do
150151
mapping do
151152
indexes :text, analyzer: 'snowball'
152153
end
153154
end
154155
```
155156

156-
The custom Elasticsearch client will be used now, with a custom index and type names,
157-
as well as the custom serialization and de-serialization logic.
157+
The custom Elasticsearch client will be used now, with a custom index, as well as the custom serialization and de-serialization logic.
158158

159159
We can create the index with the desired settings and mappings:
160160

@@ -170,7 +170,7 @@ Save the document with extra properties added by the `serialize` method:
170170
repository.save(note)
171171
# PUT http://localhost:9200/my_notes/note/1
172172
# > {"id":1,"text":"Test","my_special_key":"my_special_stuff"}
173-
{"_index"=>"my_notes", "_type"=>"my_note", "_id"=>"1", "_version"=>4, ... }
173+
{"_index"=>"my_notes", "_id"=>"1", "_version"=>4, ... }
174174
```
175175

176176
And `deserialize` it:
@@ -194,7 +194,6 @@ class NoteRepository
194194
include Elasticsearch::Persistence::Repository::DSL
195195

196196
index_name 'notes'
197-
document_type 'note'
198197
klass Note
199198

200199
settings number_of_shards: 1 do
@@ -318,36 +317,8 @@ repository.index_name
318317

319318
```
320319

321-
The `document_type` method specifies the Elasticsearch document type to use for storage, lookup and search. The default value is
322-
'_doc'. Keep in mind that future versions of Elasticsearch will not allow you to set this yourself and will use the type,
323-
'_doc'.
324-
325-
```ruby
326-
repository = NoteRepository.new(document_type: 'note')
327-
repository.document_type
328-
# => 'note'
329-
330-
```
331-
332-
or with the DSL mixin:
333-
334-
```ruby
335-
class NoteRepository
336-
include Elasticsearch::Persistence::Repository
337-
include Elasticsearch::Persistence::Repository::DSL
338-
339-
document_type 'note'
340-
end
341-
342-
repository = NoteRepository.new
343-
repository.document_type
344-
# => 'note'
345-
346-
```
347-
348320
The `klass` method specifies the Ruby class name to use when initializing objects from
349-
documents retrieved from the repository. If this value is not set, a Hash representation of the document will be
350-
returned instead.
321+
documents retrieved from the repository. If this value is not set, a Hash representation of the document will be returned instead.
351322

352323
```ruby
353324
repository = NoteRepository.new(klass: Note)
@@ -452,22 +423,22 @@ The `save` method allows you to store a domain object in the repository:
452423
```ruby
453424
note = Note.new id: 1, title: 'Quick Brown Fox'
454425
repository.save(note)
455-
# => {"_index"=>"notes_development", "_type"=>"_doc", "_id"=>"1", "_version"=>1, "created"=>true}
426+
# => {"_index"=>"notes_development", "_id"=>"1", "_version"=>1, "created"=>true}
456427
```
457428

458429
The `update` method allows you to perform a partial update of a document in the repository.
459430
Use either a partial document:
460431

461432
```ruby
462433
repository.update id: 1, title: 'UPDATED', tags: []
463-
# => {"_index"=>"notes_development", "_type"=>"_doc", "_id"=>"1", "_version"=>2}
434+
# => {"_index"=>"notes_development", "_id"=>"1", "_version"=>2}
464435
```
465436

466437
Or a script (optionally with parameters):
467438

468439
```ruby
469440
repository.update 1, script: 'if (!ctx._source.tags.contains(t)) { ctx._source.tags += t }', params: { t: 'foo' }
470-
# => {"_index"=>"notes_development", "_type"=>"_doc", "_id"=>"1", "_version"=>3}
441+
# => {"_index"=>"notes_development", "_id"=>"1", "_version"=>3}
471442
```
472443

473444

elasticsearch-rails/README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@ library, providing features suitable for Ruby on Rails applications.
66

77
## Compatibility
88

9-
This library is compatible with Ruby 1.9.3 and higher.
9+
This library is compatible with Ruby 3.1 and higher.
1010

11-
The version numbers follow the Elasticsearch major versions. Currently the `main` branch is compatible with version `7.x` of the Elasticsearch stack. **We haven't tested and updated the code for Elasticsearch `8.0` yet**.
11+
The version numbers follow the Elasticsearch major versions. Currently the `main` branch is compatible with version `8.x` of the Elasticsearch stack.
1212

13-
| Rubygem | | Elasticsearch |
14-
|:-------------:|:-:| :-----------: |
15-
| 0.1 || 1.x |
16-
| 2.x || 2.x |
17-
| 5.x || 5.x |
18-
| 6.x || 6.x |
19-
| 7.x || 7.x |
20-
| main || 7.x |
13+
| Rubygem | | Elasticsearch |
14+
|:-------:|:-:|:-------------:|
15+
| 0.1 || 1.x |
16+
| 2.x || 2.x |
17+
| 5.x || 5.x |
18+
| 6.x || 6.x |
19+
| 7.x || 7.x |
20+
| 8.x || 8.x |
21+
| main || 8.x |
2122

2223
## Installation
2324

@@ -137,9 +138,9 @@ This software is licensed under the Apache 2 license, quoted below.
137138
the Apache License, Version 2.0 (the "License"); you may
138139
not use this file except in compliance with the License.
139140
You may obtain a copy of the License at
140-
141+
141142
http://www.apache.org/licenses/LICENSE-2.0
142-
143+
143144
Unless required by applicable law or agreed to in writing,
144145
software distributed under the License is distributed on an
145146
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

0 commit comments

Comments
 (0)