es_query_builder 2.0.7 → 2.0.8

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/indexer.rb +9 -14
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fef139505248fdadeed170228ce7c1d77c535ac2
4
- data.tar.gz: 119724d2631cefaae8163d50415989aabc53da06
3
+ metadata.gz: 13b1b680537ad9eaa7be2bdffc58efbeba1c8973
4
+ data.tar.gz: 5ab39ce12c20563e0e038cf80850680a17fb8f11
5
5
  SHA512:
6
- metadata.gz: 1de09225cb34842eb70f1bdbaf72da5e54518c36f280c37cdb901c9a0032e763af6d19dfd220a6783b2f6bb8962139522039d8f6e51f856273545ba2d9bb9a85
7
- data.tar.gz: 0b9c618fe23a1a52351562a9366d6b3c1f2077570492a995cc0b07a78ed4d454ca54139c17c0e6696c11fb1222c186a27085c26c2e325fb2a907b4c32e2d3208
6
+ metadata.gz: 65a7fc7e09a40467f963246f134d1331b2d753113ad8990863e542f53bbae2f8e29c5807d909e7d298b53f7fbc6b16ab8bee97e6172de0ea913e8599729cf5c9
7
+ data.tar.gz: ea63c911a3d5031f60c101ec572a445bb2fd38026590d3f592e41e23e2f75a4fc0b9ca9097165ea488e15c7431ba7a4f84d9eb7ac65db4adb7cd7618d066b99d
data/lib/indexer.rb CHANGED
@@ -11,7 +11,7 @@ class Indexer
11
11
  end
12
12
 
13
13
  # expects data in the form of
14
- # [{update:{_index: index, _type: _doc, _id: 23, data: {doc: data }}},{index: {_index: index2, _type: _doc, _id: 28, data: data}}]
14
+ # [{update:{_index: index, _id: 23, data: {doc: data }}},{index: {_index: index2, _id: 28, data: data}}]
15
15
  # @param data [Array] Data to be indexed
16
16
  def bulk_index(data)
17
17
  check_bulk_index_params(data)
@@ -24,25 +24,23 @@ class Indexer
24
24
 
25
25
  # checks whether the record exists in the given index with given type and id
26
26
  # @param index_name [String] name of the index
27
- # @param type_name_name [String] name of the type
28
27
  # @param id [String] doc_id
29
28
  # @param parent_id [String] parent_id (optional)
30
29
  # @return [True] if record found
31
30
  # @return [False] if record not found
32
- def record_exists?(index_name, type_name, id, parent_id = nil)
33
- options_hash = generate_options_hash(index_name, type_name, id, parent_id)
31
+ def record_exists?(index_name, id, parent_id = nil)
32
+ options_hash = generate_options_hash(index_name, id, parent_id)
34
33
  @client.exists options_hash
35
34
  end
36
35
 
37
36
  # deletes the record if exists in the given index with given type and id,
38
37
  # raises DocumentNotFoundException if record is not found
39
38
  # @param index_name [String] name of the index
40
- # @param index_type [String] name of the type
41
39
  # @param id [String] doc_id
42
40
  # @param parent_id [String] parent_id
43
- def delete_record(index_name, type_name, id, parent_id = nil)
44
- if record_exists?(index_name, type_name, id, parent_id)
45
- @client.delete generate_options_hash(index_name, type_name, id, parent_id)
41
+ def delete_record(index_name, id, parent_id = nil)
42
+ if record_exists?(index_name, id, parent_id)
43
+ @client.delete generate_options_hash(index_name, id, parent_id)
46
44
  end
47
45
  end
48
46
 
@@ -97,20 +95,17 @@ class Indexer
97
95
 
98
96
  # creates new index givem the mapping and settings in index_params_hash
99
97
  # @param index_name [String] name of the index(with timestamp)
100
- # @param index_type [String] name of the type
101
98
  # @param index_params_hash, {settins:{},mappings:{}}
102
- def create_index(index_name, index_type, index_params_hash)
99
+ def create_index(index_name, index_params_hash)
103
100
  @client.indices.create index: "#{index_name}",
104
- type: "#{index_type}",
105
101
  body: index_params_hash
106
102
  end
107
103
 
108
104
  private
109
105
 
110
- def generate_options_hash(name, type, id, parent_id)
106
+ def generate_options_hash(name, id, parent_id)
111
107
  options_hash = {
112
108
  index: name,
113
- type: type,
114
109
  id: id
115
110
  }
116
111
  options_hash[:parent] = parent_id if parent_id
@@ -123,4 +118,4 @@ class Indexer
123
118
  raise "Record count should be less than #{Constants::MAX_BULK_INDEX_SIZE}" if count > Constants::MAX_BULK_INDEX_SIZE
124
119
  end
125
120
 
126
- end
121
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: es_query_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.7
4
+ version: 2.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mohib Yousuf
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2024-04-30 00:00:00.000000000 Z
14
+ date: 2024-07-23 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails