elasticsearch-client 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -16,13 +16,19 @@ Create connection:
16
16
 
17
17
  Index a document:
18
18
 
19
+ type = 'tweet'
19
20
  doc = {:id => 'abcd', :foo => 'bar'}
20
- es.add(index, doc[:id], doc)
21
+ es.add(type, doc[:id], doc)
21
22
 
22
23
  Get a document:
23
24
 
24
25
  id = '1234'
25
- es.mget(id)
26
+ es.mget(type, [id])
27
+
28
+ Get documents:
29
+
30
+ id2 = 'abcd'
31
+ es.mget(type, [id, id2])
26
32
 
27
33
  Search:
28
34
 
@@ -38,11 +44,19 @@ Search:
38
44
  }
39
45
  }
40
46
  }
41
- es.search(index, query)
47
+ es.search(type, query)
42
48
 
43
49
  Remove record:
44
50
 
45
- es.remove_by_query(index, :term => {:id => id})
51
+ es.remove(type, id)
52
+
53
+ Remove by query:
54
+
55
+ es.remove_by_query(type, :term => {:foo => 'bar'})
56
+
57
+ Remove all of type:
58
+
59
+ es.remove_all(type)
46
60
 
47
61
  ## Note on Patches/Pull Requests
48
62
 
data/lib/elasticsearch.rb CHANGED
@@ -156,6 +156,17 @@ module ElasticSearch
156
156
  end
157
157
  end
158
158
 
159
+ # Remove all of a type from this index
160
+ #
161
+ # type - the type of document to be removed
162
+ #
163
+ # Returns a hash, the parsed response body from elasticsearch
164
+ def remove_all(type)
165
+ delete do |req|
166
+ req.url "#{@name}/#{type}"
167
+ end
168
+ end
169
+
159
170
  # Remove a collection of documents matched by a query
160
171
  #
161
172
  # types - the type or types to query
@@ -1,3 +1,3 @@
1
1
  module ElasticSearch
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jonathan Hoyt