whiskers-es 0.1.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 +7 -0
- data/README.md +41 -0
- data/lib/tasks/elasticsearch.rake +549 -0
- data/lib/whiskers-es.rb +1 -0
- data/lib/whiskers_es.rb +3 -0
- data/lib/whiskers_es/railtie.rb +11 -0
- data/lib/whiskers_es/version.rb +3 -0
- metadata +90 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 31fcad39992b16debe9eaf5d4a1fc0b9f08b94f6
|
4
|
+
data.tar.gz: cf1232d1bbe7665a53429018f41978d9fccfe732
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ed6d7f4083bdcf81f6ef6df3e7e06146e87916c4befd1b73a0e093b202899a3394eb123653e7a122cf08fd6169a2e98e0b312b1348e68224d31cfce630f5f6fc
|
7
|
+
data.tar.gz: e55318547058737e69f6ebd89f9e8de6778be11acaf190408886002dfb2e46058a506b0405e591cf4680a9ddad050a4ff61e3fbd87277874fbd89743a98e4a3d
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# Description
|
2
|
+
|
3
|
+
This repo contains scripts for managing the [Elasticsearch](https://www.elastic.co/products/elasticsearch) server that is used by the [zilly-backend]() Rails app
|
4
|
+
|
5
|
+
# Getting Started
|
6
|
+
This is a brief description of the steps to follow.
|
7
|
+
|
8
|
+
1. Install [Ruby](https://www.ruby-lang.org/en/downloads/) or via [rvm](https://rvm.io/rvm/install) with the command `$ rvm install 2.3.4`
|
9
|
+
2. Install [Elasitcsearch](https://www.elastic.co/downloads/elasticsearch).
|
10
|
+
|
11
|
+
## Dependencies:
|
12
|
+
The project requires:
|
13
|
+
|
14
|
+
1. Ruby version 2.3.4
|
15
|
+
2. Elasticsearch server
|
16
|
+
|
17
|
+
## Run it
|
18
|
+
1. Install bundler gem:
|
19
|
+
```
|
20
|
+
$ gem install bundler
|
21
|
+
```
|
22
|
+
2. Install all gem dependences:
|
23
|
+
```
|
24
|
+
$ bundle install
|
25
|
+
```
|
26
|
+
3. Configure environment variables
|
27
|
+
```
|
28
|
+
$ cp .env.example .env
|
29
|
+
$ nano .env
|
30
|
+
```
|
31
|
+
6. Elasticsearch index setup
|
32
|
+
```
|
33
|
+
$ bundle exec rake elasticsearch:create_indices elasticsearch:create_aliases
|
34
|
+
```
|
35
|
+
*Note: Indexes will be empty. Ask around if you need to import data.*
|
36
|
+
|
37
|
+
## Choosing a server
|
38
|
+
To point the script at a server other than your local server, just edit the `ELASTICSEARCH_URL` environment variable in the `.env` file.
|
39
|
+
|
40
|
+
## Rake tasks
|
41
|
+
Run `bundle exec rake -T` to see a list of all available Rake tasks.
|
@@ -0,0 +1,549 @@
|
|
1
|
+
namespace :elasticsearch do
|
2
|
+
property_search_prefix = 'properties-search-v'.freeze
|
3
|
+
property_search_alias = 'properties-search-current'.freeze
|
4
|
+
property_full_prefix = 'properties-full-v'.freeze
|
5
|
+
property_full_alias = 'properties-full-current'.freeze
|
6
|
+
property_search_mapping = {
|
7
|
+
settings: {
|
8
|
+
analysis: {
|
9
|
+
analyzer: {
|
10
|
+
as_you_type: {
|
11
|
+
tokenizer: :standard,
|
12
|
+
filter: [:lowercase, :synonym, :edge_filter]
|
13
|
+
},
|
14
|
+
full_words: {
|
15
|
+
tokenizer: :standard,
|
16
|
+
filter: [:lowercase, :synonym]
|
17
|
+
}
|
18
|
+
},
|
19
|
+
filter: {
|
20
|
+
edge_filter: {
|
21
|
+
type: 'edgeNGram',
|
22
|
+
min_gram: 1,
|
23
|
+
max_gram: 12
|
24
|
+
},
|
25
|
+
synonym: {
|
26
|
+
type: :synonym,
|
27
|
+
synonyms: [
|
28
|
+
# Street suffixes
|
29
|
+
'allee, aly, ally => alley',
|
30
|
+
'anex, anx, annx => annex',
|
31
|
+
'arc => arcade',
|
32
|
+
'av, ave, aven, avenu, avnue => avenue',
|
33
|
+
'bch => beach',
|
34
|
+
'bg => burg',
|
35
|
+
'bgs => burgs',
|
36
|
+
'blf, bluf => bluff',
|
37
|
+
'blfs => bluffs',
|
38
|
+
'blvd, boul, boulv => boulevard',
|
39
|
+
'bnd => bend',
|
40
|
+
'bot, btm, bottm => bottom',
|
41
|
+
'br, brnch => branch',
|
42
|
+
'brg, brdge => bridge',
|
43
|
+
'brk => brook',
|
44
|
+
'brks => brooks',
|
45
|
+
'byp, byps, bypa, bypas => bypass',
|
46
|
+
'byu, bayoo => bayou',
|
47
|
+
'cen',
|
48
|
+
'cir, circ, crcl, circl, crcle => circle',
|
49
|
+
'cirs => circles',
|
50
|
+
'clb => club',
|
51
|
+
'clf => cliff',
|
52
|
+
'clfs => cliffs',
|
53
|
+
'cmn => common',
|
54
|
+
'cmns => commons',
|
55
|
+
'cor => corner',
|
56
|
+
'cors => corners',
|
57
|
+
'cp, cmp => camp',
|
58
|
+
'cpe => cape',
|
59
|
+
'cres, crsnt, crsent => crescent',
|
60
|
+
'crk => creek',
|
61
|
+
'crse => course',
|
62
|
+
'crst => crest',
|
63
|
+
'cswy, causwa => causeway',
|
64
|
+
'crt => court',
|
65
|
+
'ctr, cntr, cent, centr, cnter, centre => center',
|
66
|
+
'ctrs => centers',
|
67
|
+
'cts => courts',
|
68
|
+
'curv => curve',
|
69
|
+
'cv => cove',
|
70
|
+
'cvs => coves',
|
71
|
+
'cyn, cnyn, canyn => canyon',
|
72
|
+
'dl => dale',
|
73
|
+
'dm => dam',
|
74
|
+
'dr, drv, driv => drive',
|
75
|
+
'drs => drives',
|
76
|
+
'dv, div => divide',
|
77
|
+
'dvd',
|
78
|
+
'est => estate',
|
79
|
+
'ests => estates',
|
80
|
+
'exp, expr, expw, expy, express => expressway',
|
81
|
+
'ext, extn, extnsn => extension',
|
82
|
+
'exts => extensions',
|
83
|
+
'fld => field',
|
84
|
+
'flds => fields',
|
85
|
+
'fls => falls',
|
86
|
+
'flt => flat',
|
87
|
+
'flts => flats',
|
88
|
+
'frd => ford',
|
89
|
+
'frds => fords',
|
90
|
+
'frg, forg => forge',
|
91
|
+
'frgs => forges',
|
92
|
+
'frk => fork',
|
93
|
+
'frks => forks',
|
94
|
+
'frst => forest',
|
95
|
+
'frst => forests',
|
96
|
+
'fry, frry => ferry',
|
97
|
+
'ft, frt => fort',
|
98
|
+
'fwy, frwy, frway, freewy => freeway',
|
99
|
+
'gdn, grdn, gardn, grden => garden',
|
100
|
+
'gdns, grdns => gardens',
|
101
|
+
'gln => glen',
|
102
|
+
'glns => glens',
|
103
|
+
'grn => green',
|
104
|
+
'grns => greens',
|
105
|
+
'grv, grov => grove',
|
106
|
+
'grvs => groves',
|
107
|
+
'gtwy, gtway, gatewy, gatway => gateway',
|
108
|
+
'hbr, harb, harbr, hrbor => harbor',
|
109
|
+
'hbrs => harbors',
|
110
|
+
'hl => hill',
|
111
|
+
'hllw, holw, holws, hollows => hollow',
|
112
|
+
'hls => hills',
|
113
|
+
'ht, hts => heights',
|
114
|
+
'hvn => haven',
|
115
|
+
'hwy, hiwy, hway, hiway, highwy => highway',
|
116
|
+
'inlt => inlet',
|
117
|
+
'is, islnd => island',
|
118
|
+
'isles => isle',
|
119
|
+
'iss, islnds => islands',
|
120
|
+
'jct, jctn, jction, junctn, juncton => junction',
|
121
|
+
'jcts, jctns => junctions',
|
122
|
+
'knl, knol => knoll',
|
123
|
+
'knls => knolls',
|
124
|
+
'kys => keys',
|
125
|
+
'lck => lock',
|
126
|
+
'lcks => locks',
|
127
|
+
'ldg, ldge, lodg => lodge',
|
128
|
+
'lf => loaf',
|
129
|
+
'lgt => light',
|
130
|
+
'lgts => lights',
|
131
|
+
'lk => lake',
|
132
|
+
'lks => lakes',
|
133
|
+
'ln => lane',
|
134
|
+
'lndg, lndng => landing',
|
135
|
+
'loops => loop',
|
136
|
+
'mdw => meadow',
|
137
|
+
'mdws, medows => meadows',
|
138
|
+
'ml => mill',
|
139
|
+
'mls => mills',
|
140
|
+
'mnr => manor',
|
141
|
+
'mnrs => manors',
|
142
|
+
'msn, mssn, missn => mission',
|
143
|
+
'mnt, mtn, mtin, mntn, mount, mntain, mountin => mountain',
|
144
|
+
'mtns, mntns => mountains',
|
145
|
+
'mtwy => motorway',
|
146
|
+
'nck => neck',
|
147
|
+
'opas => overpass',
|
148
|
+
'orch, orchrd => orchard',
|
149
|
+
'ovl => oval',
|
150
|
+
'pkwys => parkways',
|
151
|
+
'pky, pkwy, pkway, parkwy => parkway',
|
152
|
+
'pl => place',
|
153
|
+
'pln => plain',
|
154
|
+
'plns => plains',
|
155
|
+
'plz, plza => plaza',
|
156
|
+
'pne => pine',
|
157
|
+
'pnes => pines',
|
158
|
+
'prr => prairie',
|
159
|
+
'prk => park',
|
160
|
+
'prt => port',
|
161
|
+
'prts => ports',
|
162
|
+
'psge => passage',
|
163
|
+
'pt => point',
|
164
|
+
'pts => points',
|
165
|
+
'rad, radl, radiel => radial',
|
166
|
+
'rd => road',
|
167
|
+
'rdg, rdge => ridge',
|
168
|
+
'rdgs => ridges',
|
169
|
+
'rds => roads',
|
170
|
+
'riv, rvr, rivr => river',
|
171
|
+
'rnch => ranch',
|
172
|
+
'rnchs => ranches',
|
173
|
+
'rpd => rapid',
|
174
|
+
'rpds => rapids',
|
175
|
+
'rst => rest',
|
176
|
+
'rte => route',
|
177
|
+
'shl => shoal',
|
178
|
+
'shls => shoals',
|
179
|
+
'shr, shoar => shore',
|
180
|
+
'shrs, shoars => shores',
|
181
|
+
'skwy => skyway',
|
182
|
+
'smt, sumit, sumitt => summit',
|
183
|
+
'spg, spng, sprng, spring => springs',
|
184
|
+
'spgs, spngs, sprngs => springs',
|
185
|
+
'sq, squ, sqr, sqre => square',
|
186
|
+
'sqrs, sqs => squares',
|
187
|
+
'st, str, strt => street',
|
188
|
+
'sta, stn, statn => station',
|
189
|
+
'stra, strav, strvn, stravn, strvnue, straven => stravenue',
|
190
|
+
'strm, streme => stream',
|
191
|
+
'sts => streets',
|
192
|
+
'ter, terr => terrace',
|
193
|
+
'tpke, trnpk, turnpk => turnpike',
|
194
|
+
'trce => trace',
|
195
|
+
'trfy => trafficway',
|
196
|
+
'trk, trak => track',
|
197
|
+
'trks => tracks',
|
198
|
+
'trl => trail',
|
199
|
+
'trlr, trlrs => trailer',
|
200
|
+
'trls => trails',
|
201
|
+
'trwy => throughway',
|
202
|
+
'tunl, tunel, tunnl, tunls, tunnels => tunnel',
|
203
|
+
'un => union',
|
204
|
+
'uns => unions',
|
205
|
+
'upas => underpass',
|
206
|
+
'via, vdct, viadct => viaduct',
|
207
|
+
'vill',
|
208
|
+
'vis, vst, vist, vsta => vista',
|
209
|
+
'vl => ville',
|
210
|
+
'vlg, villg, villag, village, villiage => village',
|
211
|
+
'vlgs => villages',
|
212
|
+
'vly, vlly, vally => valley',
|
213
|
+
'vlys => valleys',
|
214
|
+
'vw => view',
|
215
|
+
'vws => views',
|
216
|
+
'wl => well',
|
217
|
+
'wls => wells',
|
218
|
+
'xing, crssng => crossing',
|
219
|
+
'xrd => crossroad',
|
220
|
+
'xrds => crossroads',
|
221
|
+
|
222
|
+
# Unit Designators
|
223
|
+
'apt => apartment',
|
224
|
+
'bsmt => basement',
|
225
|
+
'bldg => building',
|
226
|
+
'dept => department',
|
227
|
+
'fl => floor',
|
228
|
+
'frnt => front',
|
229
|
+
'hngr => hangar',
|
230
|
+
'lbby => lobby',
|
231
|
+
'lowr => lower',
|
232
|
+
'ofc => office',
|
233
|
+
'ph => penthouse',
|
234
|
+
'rm => room',
|
235
|
+
'spc => space',
|
236
|
+
'ste => suite',
|
237
|
+
'uppr => upper',
|
238
|
+
|
239
|
+
# States
|
240
|
+
'al, ala => alabama',
|
241
|
+
'ak, alaska => alaska',
|
242
|
+
'as, samoa => american',
|
243
|
+
'az, ariz => arizona',
|
244
|
+
'ar, ark => arkansas',
|
245
|
+
'ca, calif => california',
|
246
|
+
'co, colo => colorado',
|
247
|
+
'conn => connecticut',
|
248
|
+
'de, del => delaware',
|
249
|
+
'dc, dist of columbia => district of columbia',
|
250
|
+
'fl, fla => florida',
|
251
|
+
'ga => georgia',
|
252
|
+
'gu, guam => guam',
|
253
|
+
'hi, hawaii => hawaii',
|
254
|
+
'id, idaho => idaho',
|
255
|
+
'il, ill => illinois',
|
256
|
+
'in, ind => indiana',
|
257
|
+
'ia, iowa => iowa',
|
258
|
+
'ks, kans => kansas',
|
259
|
+
'la => louisiana',
|
260
|
+
'me => maine',
|
261
|
+
'md => maryland',
|
262
|
+
'mh => marshall islands ',
|
263
|
+
'ma, mass => massachusetts',
|
264
|
+
'mi, mich => michigan',
|
265
|
+
'fm => micronesia ',
|
266
|
+
'mn, minn => minnesota',
|
267
|
+
'ms, miss => mississippi',
|
268
|
+
'mo => missouri',
|
269
|
+
'mont => montana',
|
270
|
+
'ne, nebr => nebraska',
|
271
|
+
'nv, nev => nevada',
|
272
|
+
'nh => new hampshire',
|
273
|
+
'nj => new jersey',
|
274
|
+
'nm => new mexico',
|
275
|
+
'ny => new york',
|
276
|
+
'nc => north carolina',
|
277
|
+
'nd => north dakota',
|
278
|
+
'mp => northern marianas ',
|
279
|
+
'oh => ohio',
|
280
|
+
'ok, okla => oklahoma',
|
281
|
+
'or, ore => oregon',
|
282
|
+
'pw => palau ',
|
283
|
+
'pa => pennsylvania',
|
284
|
+
'ri => rhode island',
|
285
|
+
'sc => south carolina',
|
286
|
+
'sd => south dakota',
|
287
|
+
'tn, tenn => tennessee',
|
288
|
+
'tx, tex => texas',
|
289
|
+
'ut => utah',
|
290
|
+
'vt => vermont',
|
291
|
+
'va => virginia',
|
292
|
+
'vi => virgin islands',
|
293
|
+
'wa, wash => washington',
|
294
|
+
'wv, wva => west virginia',
|
295
|
+
'wi, wis => wisconsin',
|
296
|
+
'wyo => wyoming',
|
297
|
+
|
298
|
+
# Compass points
|
299
|
+
'n => north',
|
300
|
+
's => south',
|
301
|
+
'e => east',
|
302
|
+
'w => west'
|
303
|
+
],
|
304
|
+
ignore_case: true,
|
305
|
+
expand: false
|
306
|
+
}
|
307
|
+
}
|
308
|
+
}
|
309
|
+
},
|
310
|
+
mappings: {
|
311
|
+
:'property-search' => {
|
312
|
+
properties: {
|
313
|
+
z_property_id: {
|
314
|
+
type: :string,
|
315
|
+
index: :not_analyzed
|
316
|
+
},
|
317
|
+
photo: {
|
318
|
+
type: :string,
|
319
|
+
index: :no
|
320
|
+
},
|
321
|
+
street_address: {
|
322
|
+
type: :text,
|
323
|
+
analyzer: :as_you_type,
|
324
|
+
search_analyzer: :full_words,
|
325
|
+
fields: {
|
326
|
+
full_words: {
|
327
|
+
type: :text,
|
328
|
+
analyzer: :full_words,
|
329
|
+
search_analyzer: :full_words
|
330
|
+
}
|
331
|
+
}
|
332
|
+
},
|
333
|
+
unit_number: {
|
334
|
+
type: :text,
|
335
|
+
analyzer: :as_you_type,
|
336
|
+
search_analyzer: :full_words,
|
337
|
+
fields: {
|
338
|
+
full_words: {
|
339
|
+
type: :text,
|
340
|
+
analyzer: :full_words,
|
341
|
+
search_analyzer: :full_words
|
342
|
+
}
|
343
|
+
}
|
344
|
+
},
|
345
|
+
city: {
|
346
|
+
type: :text,
|
347
|
+
analyzer: :as_you_type,
|
348
|
+
search_analyzer: :full_words,
|
349
|
+
fields: {
|
350
|
+
full_words: {
|
351
|
+
type: :text,
|
352
|
+
analyzer: :full_words,
|
353
|
+
search_analyzer: :full_words
|
354
|
+
}
|
355
|
+
}
|
356
|
+
},
|
357
|
+
state: {
|
358
|
+
type: :text,
|
359
|
+
analyzer: :as_you_type,
|
360
|
+
search_analyzer: :full_words,
|
361
|
+
fields: {
|
362
|
+
full_words: {
|
363
|
+
type: :text,
|
364
|
+
analyzer: :full_words,
|
365
|
+
search_analyzer: :full_words
|
366
|
+
}
|
367
|
+
}
|
368
|
+
},
|
369
|
+
zip_code: {
|
370
|
+
type: :text,
|
371
|
+
analyzer: :as_you_type,
|
372
|
+
search_analyzer: :full_words,
|
373
|
+
fields: {
|
374
|
+
full_words: {
|
375
|
+
type: :text,
|
376
|
+
analyzer: :full_words,
|
377
|
+
search_analyzer: :full_words
|
378
|
+
}
|
379
|
+
}
|
380
|
+
},
|
381
|
+
mls_number: {
|
382
|
+
type: :string,
|
383
|
+
index: :not_analyzed
|
384
|
+
},
|
385
|
+
location: {
|
386
|
+
type: :geo_point
|
387
|
+
},
|
388
|
+
number_of_units: {
|
389
|
+
type: :short,
|
390
|
+
index: :no
|
391
|
+
},
|
392
|
+
building_size: {
|
393
|
+
type: :integer,
|
394
|
+
index: :not_analyzed
|
395
|
+
},
|
396
|
+
half_baths: {
|
397
|
+
type: :short,
|
398
|
+
index: :no
|
399
|
+
},
|
400
|
+
full_baths: {
|
401
|
+
type: :short,
|
402
|
+
index: :not_analyzed
|
403
|
+
},
|
404
|
+
bedrooms: {
|
405
|
+
type: :short,
|
406
|
+
index: :not_analyzed
|
407
|
+
},
|
408
|
+
price: {
|
409
|
+
type: :integer,
|
410
|
+
index: :not_analyzed
|
411
|
+
}
|
412
|
+
}
|
413
|
+
}
|
414
|
+
}
|
415
|
+
}.freeze
|
416
|
+
|
417
|
+
namespace :property do
|
418
|
+
namespace :search do
|
419
|
+
desc 'Create the property search index in elasticsearch'
|
420
|
+
task :create_index, [:version] => [:dotenv] do |t, args|
|
421
|
+
args.with_defaults version: 1
|
422
|
+
|
423
|
+
client.indices.create(
|
424
|
+
index: [property_search_prefix, args[:version]].join,
|
425
|
+
body: property_search_mapping
|
426
|
+
)
|
427
|
+
end
|
428
|
+
|
429
|
+
desc 'Delete the property search index in elasticsearch'
|
430
|
+
task :delete_index, [:version] => [:dotenv] do |t, args|
|
431
|
+
args.with_defaults version: 1
|
432
|
+
|
433
|
+
client.indices.delete index: [property_search_prefix, args[:version]].join
|
434
|
+
end
|
435
|
+
|
436
|
+
desc 'Recreate the property search index in elasticsearch'
|
437
|
+
task :recreate_index, [:version] => [:delete_index, :create_index]
|
438
|
+
|
439
|
+
desc 'Create the property search alias in elasticsearch'
|
440
|
+
task :create_alias, [:version] => [:dotenv] do |t, args|
|
441
|
+
args.with_defaults version: 1
|
442
|
+
|
443
|
+
client.indices.put_alias(
|
444
|
+
index: [property_search_prefix, args[:version]].join,
|
445
|
+
name: property_search_alias
|
446
|
+
)
|
447
|
+
end
|
448
|
+
|
449
|
+
desc 'Delete the property search alias in elasticsearch'
|
450
|
+
task :delete_alias, [:version] => [:dotenv] do |t, args|
|
451
|
+
args.with_defaults version: 1
|
452
|
+
|
453
|
+
client.indices.delete_alias(
|
454
|
+
index: [property_search_prefix, args[:version]].join,
|
455
|
+
name: property_search_alias
|
456
|
+
)
|
457
|
+
end
|
458
|
+
|
459
|
+
desc 'Recreate the property search alias in elasticsearch'
|
460
|
+
task :recreate_alias, [:version] => [:delete_alias, :create_alias]
|
461
|
+
end
|
462
|
+
|
463
|
+
namespace :full do
|
464
|
+
desc 'Create the full property index in elasticsearch'
|
465
|
+
task :create_index, [:version] => [:dotenv] do |t, args|
|
466
|
+
args.with_defaults version: 1
|
467
|
+
|
468
|
+
client.indices.create(
|
469
|
+
index: [property_full_prefix, args[:version]].join
|
470
|
+
# TODO: no mapping for the full index yet
|
471
|
+
# body: PROPERTY_FULL_MAPPING
|
472
|
+
)
|
473
|
+
end
|
474
|
+
|
475
|
+
desc 'Delete the full property index in elasticsearch'
|
476
|
+
task :delete_index, [:version] => [:dotenv] do |t, args|
|
477
|
+
args.with_defaults version: 1
|
478
|
+
|
479
|
+
client.indices.delete index: [property_full_prefix, args[:version]].join
|
480
|
+
end
|
481
|
+
|
482
|
+
desc 'Recreate the full property index in elasticsearch'
|
483
|
+
task :recreate_index, [:version] => [:delete_index, :create_index]
|
484
|
+
|
485
|
+
desc 'Create the full property alias in elasticsearch'
|
486
|
+
task :create_alias, [:version] => [:dotenv] do |t, args|
|
487
|
+
args.with_defaults version: 1
|
488
|
+
|
489
|
+
client.indices.put_alias(
|
490
|
+
index: [property_full_prefix, args[:version]].join,
|
491
|
+
name: property_full_alias
|
492
|
+
)
|
493
|
+
end
|
494
|
+
|
495
|
+
desc 'Delete the full property alias in elasticsearch'
|
496
|
+
task :delete_alias, [:version] => [:dotenv] do |t, args|
|
497
|
+
args.with_defaults version: 1
|
498
|
+
|
499
|
+
client.indices.delete_alias(
|
500
|
+
index: [property_full_prefix, args[:version]].join,
|
501
|
+
name: property_full_alias
|
502
|
+
)
|
503
|
+
end
|
504
|
+
|
505
|
+
desc 'Recreate the full property alias in elasticsearch'
|
506
|
+
task :recreate_alias, [:version] => [:delete_alias, :create_alias]
|
507
|
+
end
|
508
|
+
|
509
|
+
desc 'Create all property indices in elasticsearch'
|
510
|
+
task :create_indices, [:version] => ['search:create_index', 'full:create_index']
|
511
|
+
|
512
|
+
desc 'Delete all property indices in elasticsearch'
|
513
|
+
task :delete_indices, [:version] => ['search:delete_index', 'full:delete_index']
|
514
|
+
|
515
|
+
desc 'Recreate all property indices in elasticsearch'
|
516
|
+
task :recreate_indices, [:version] => ['search:recreate_index', 'full:recreate_index']
|
517
|
+
|
518
|
+
desc 'Create all property aliases in elasticsearch'
|
519
|
+
task :create_aliases, [:version] => ['search:create_alias', 'full:create_alias']
|
520
|
+
|
521
|
+
desc 'Delete all property aliases in elasticsearch'
|
522
|
+
task :delete_aliases, [:version] => ['search:delete_alias', 'full:delete_alias']
|
523
|
+
|
524
|
+
desc 'Recreate all property aliases in elasticsearch'
|
525
|
+
task :recreate_aliases, [:version] => ['search:recreate_alias', 'full:recreate_alias']
|
526
|
+
end
|
527
|
+
|
528
|
+
desc 'Create all indices in elasticsearch'
|
529
|
+
task :create_indices, [:version] => ['property:create_indices']
|
530
|
+
|
531
|
+
desc 'Delete all indices in elasticsearch'
|
532
|
+
task :delete_indices, [:version] => ['property:delete_indices']
|
533
|
+
|
534
|
+
desc 'Recreate all indices in elasticsearch'
|
535
|
+
task :recreate_indices, [:version] => ['property:recreate_indices']
|
536
|
+
|
537
|
+
desc 'Create all aliases in elasticsearch'
|
538
|
+
task :create_aliases, [:version] => ['property:create_aliases']
|
539
|
+
|
540
|
+
desc 'Delete all aliases in elasticsearch'
|
541
|
+
task :delete_aliases, [:version] => ['property:delete_aliases']
|
542
|
+
|
543
|
+
desc 'Recreate all aliases in elasticsearch'
|
544
|
+
task :recreate_aliases, [:version] => ['property:recreate_aliases']
|
545
|
+
|
546
|
+
def client
|
547
|
+
@client ||= Elasticsearch::Client.new
|
548
|
+
end
|
549
|
+
end
|
data/lib/whiskers-es.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'whiskers_es'
|
data/lib/whiskers_es.rb
ADDED
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: whiskers-es
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adam Crownoble
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-09-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: elasticsearch
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '12.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '12.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '12.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '12.0'
|
55
|
+
description: Elasticsearch index configuration rake tasks for Zilly property data
|
56
|
+
email: adam@codenoble.com
|
57
|
+
executables: []
|
58
|
+
extensions: []
|
59
|
+
extra_rdoc_files: []
|
60
|
+
files:
|
61
|
+
- README.md
|
62
|
+
- lib/tasks/elasticsearch.rake
|
63
|
+
- lib/whiskers-es.rb
|
64
|
+
- lib/whiskers_es.rb
|
65
|
+
- lib/whiskers_es/railtie.rb
|
66
|
+
- lib/whiskers_es/version.rb
|
67
|
+
homepage: https://github.com/zillyinc/whiskers-es
|
68
|
+
licenses: []
|
69
|
+
metadata: {}
|
70
|
+
post_install_message:
|
71
|
+
rdoc_options: []
|
72
|
+
require_paths:
|
73
|
+
- lib
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
requirements: []
|
85
|
+
rubyforge_project:
|
86
|
+
rubygems_version: 2.5.1
|
87
|
+
signing_key:
|
88
|
+
specification_version: 4
|
89
|
+
summary: Elasticsearch index configuration rake tasks for Zilly
|
90
|
+
test_files: []
|