scalastic 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e03696369ef2695acb79cad272e8f6fedc263c37
4
- data.tar.gz: 606aeeb6040d291368bf23fcb5ba0ee9fad63b6c
3
+ metadata.gz: 5eaea5d5ea27529e7fd71ac835aa12a20fb4f6f7
4
+ data.tar.gz: ab107d4bc5e24cd69d3fe535d540957e4c4e83e5
5
5
  SHA512:
6
- metadata.gz: 37c76201da581d93675e0a792d8f5287ccf21ed7746a344e5b7959e0e6ca383eb5f4dc6a25b9270f34aa8f96bcb46949e97f444f9c4b38a64846236b8d022f59
7
- data.tar.gz: f157f7cf2226f63a34fa13e711ad81df849370986fba6f3ef077bd041fa0288462c557357a6d34fd78b6c859225cfdc99098c912390a93e4c1056f68b01be275
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Scalastic
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
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.3.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 00:00:00.000000000 Z
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: '0'
118
+ version: '1.9'
119
119
  required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - ">="