scalastic 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +19 -0
- data/lib/scalastic/partition.rb +5 -0
- data/lib/scalastic/version.rb +1 -1
- data/scalastic.gemspec +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5eaea5d5ea27529e7fd71ac835aa12a20fb4f6f7
|
4
|
+
data.tar.gz: ab107d4bc5e24cd69d3fe535d540957e4c4e83e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2203b940e31523fd84ec2dee701ab3fc5ef46dc9007104592672b6e04dd0515c034ea0e1db249b21159dfc7d70d8c2c074a70fa94320a65ee3d8d02fbada7b2c
|
7
|
+
data.tar.gz: 80604212d8a574a5b94d208eb6cc9e363e6ad95131acce8dd733dde60168e8e0d4269e0cadbda5ac8e7a899d4e49dc4ba35b7b3de54384aa2a2e611b48abb464
|
data/README.md
CHANGED
@@ -135,6 +135,25 @@ count = partition1.search(search_type: 'count', body: {query: {match_all: {}}})[
|
|
135
135
|
raise "Expected 1 document, got #{count}" unless count == 1
|
136
136
|
```
|
137
137
|
|
138
|
+
### Getting a document by its id
|
139
|
+
```ruby
|
140
|
+
client = Elasticsearch::Client.new
|
141
|
+
client.indices.create(index: 'document_get')
|
142
|
+
client.partitions.prepare_index(index: 'document_get')
|
143
|
+
|
144
|
+
p = client.partitions.create(id: 1, index: 'document_get')
|
145
|
+
p.index(id: 1, type: 'test', body: {title: 'Test'})
|
146
|
+
|
147
|
+
res = p.get(id: 1, type: 'test')
|
148
|
+
raise "Unexpected result: #{res}" unless res == {'_index' => 'document_get', '_type' => 'test', '_id' => '1', '_version' => 1, 'found' => true, '_source' => {'title' => 'Test', 'scalastic_partition_id' => 1}}
|
149
|
+
|
150
|
+
p = client.partitions.create(id: 2, index: 'document_get', routing: 12345)
|
151
|
+
p.index(id: 2, type: 'test', body: {title: 'Routing test'})
|
152
|
+
|
153
|
+
res = p.get(id: 2, type: 'test')
|
154
|
+
raise "Unexpected result: #{res}" unless res == {'_index' => 'document_get', '_type' => 'test', '_id' => '2', '_version' => 1, 'found' => true, '_source' => {'title' => 'Routing test', 'scalastic_partition_id' => 2}}
|
155
|
+
```
|
156
|
+
|
138
157
|
### Bulk operations
|
139
158
|
```ruby
|
140
159
|
client = Elasticsearch::Client.new
|
data/lib/scalastic/partition.rb
CHANGED
@@ -33,6 +33,11 @@ module Scalastic
|
|
33
33
|
es_client.search(args)
|
34
34
|
end
|
35
35
|
|
36
|
+
def get(args)
|
37
|
+
args = args.merge(index: config.search_endpoint(id))
|
38
|
+
es_client.get(args)
|
39
|
+
end
|
40
|
+
|
36
41
|
def index(args)
|
37
42
|
args = {body: {}}.merge(args)
|
38
43
|
args[:body][config.partition_selector.to_sym] = id
|
data/lib/scalastic/version.rb
CHANGED
data/scalastic.gemspec
CHANGED
@@ -13,6 +13,7 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.description = "Elasticsearch alias-based partitions for scalable indexing and searching"
|
14
14
|
spec.homepage = "https://github.com/aliakb/scalastic"
|
15
15
|
spec.license = "MIT"
|
16
|
+
spec.required_ruby_version = ">= 1.9"
|
16
17
|
|
17
18
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
19
|
spec.bindir = "exe"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scalastic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aliaksei Baturytski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-02-
|
11
|
+
date: 2016-02-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -115,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
115
|
requirements:
|
116
116
|
- - ">="
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version: '
|
118
|
+
version: '1.9'
|
119
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
121
|
- - ">="
|