@@ -31,7 +31,7 @@ The goal of this project is to implement an application called `product-app`. It
31
31
docker-compose up -d
32
32
----
33
33
34
- * Wait until the `Elasticsearch` docker container is up and healthy. To check it, run
34
+ * Wait until `Elasticsearch` docker container is up and healthy. To check it, run
35
35
+
36
36
[source]
37
37
----
@@ -199,6 +199,11 @@ image::images/demo-user-interaction.gif[]
199
199
----
200
200
docker-compose down -v
201
201
----
202
+ * To remove the Docker images created by this project, run
203
+ [source]
204
+ ----
205
+ ./remove-docker-images.sh
206
+ ----
202
207
203
208
== Creating indexes and reindexing them using Elasticsearch REST API
204
209
@@ -218,17 +223,17 @@ It should return something like
218
223
[source]
219
224
----
220
225
{
221
- "name" : "fadee0b011b7 ",
226
+ "name" : "e7f07cc75f5c ",
222
227
"cluster_name" : "docker-es-cluster",
223
- "cluster_uuid" : "iO1Ne0WXRDeQYZyGp3DaWQ ",
228
+ "cluster_uuid" : "RthzZuf2QHKxPX--9cLWtg ",
224
229
"version" : {
225
- "number" : "7.6.2 ",
226
- "build_flavor" : "oss ",
230
+ "number" : "7.12.1 ",
231
+ "build_flavor" : "default ",
227
232
"build_type" : "docker",
228
- "build_hash" : "ef48eb35cf30adf4db14086e8aabd07ef6fb113f ",
229
- "build_date" : "2020-03-26T06:34:37.794943Z ",
233
+ "build_hash" : "3186837139b9c6b6d23c3200870651f10d3343b7 ",
234
+ "build_date" : "2021-04-20T20:56:39.040728659Z ",
230
235
"build_snapshot" : false,
231
- "lucene_version" : "8.4 .0",
236
+ "lucene_version" : "8.8 .0",
232
237
"minimum_wire_compatibility_version" : "6.8.0",
233
238
"minimum_index_compatibility_version" : "6.0.0-beta1"
234
239
},
@@ -247,7 +252,7 @@ It should return
247
252
+
248
253
[source]
249
254
----
250
- { "acknowledged":true, "shards_acknowledged":true, "index":"ecommerce.products.v1" }
255
+ {"acknowledged":true,"shards_acknowledged":true,"index":"ecommerce.products.v1"}
251
256
----
252
257
253
258
* Check indexes
@@ -262,7 +267,7 @@ It should return something like
262
267
[source]
263
268
----
264
269
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
265
- yellow open ecommerce.products.v1 1B3JXm6zQnKolob4mtwRUg 1 1 0 0 230b 230b
270
+ yellow open ecommerce.products.v1 1cgjRUxQQVW_uFfc3nYFcg 1 1 0 0 208b 208b
266
271
----
267
272
268
273
* Check `ecommerce.products.v1` index mapping
@@ -277,20 +282,40 @@ It should return
277
282
[source]
278
283
----
279
284
{
280
- "ecommerce.products.v1": {
281
- "mappings": {
282
- "properties": {
283
- "categories": { "type": "keyword" },
284
- "created": { "type": "date", "format": "strict_date_time_no_millis||yyyy-MM-dd'T'HH:mmZZ" },
285
- "description": { "type": "text" },
286
- "name": { "type": "text" },
287
- "price": { "type": "float" },
288
- "reference": { "type": "text" },
289
- "reviews": {
290
- "properties": {
291
- "comment": { "type": "text" },
292
- "created": { "type": "date", "format": "strict_date_time_no_millis||yyyy-MM-dd'T'HH:mmZZ" },
293
- "stars": { "type": "short" }
285
+ "ecommerce.products.v1" : {
286
+ "mappings" : {
287
+ "properties" : {
288
+ "categories" : {
289
+ "type" : "keyword"
290
+ },
291
+ "created" : {
292
+ "type" : "date",
293
+ "format" : "strict_date_time_no_millis||yyyy-MM-dd'T'HH:mmZZ"
294
+ },
295
+ "description" : {
296
+ "type" : "text"
297
+ },
298
+ "name" : {
299
+ "type" : "text"
300
+ },
301
+ "price" : {
302
+ "type" : "float"
303
+ },
304
+ "reference" : {
305
+ "type" : "text"
306
+ },
307
+ "reviews" : {
308
+ "properties" : {
309
+ "comment" : {
310
+ "type" : "text"
311
+ },
312
+ "created" : {
313
+ "type" : "date",
314
+ "format" : "strict_date_time_no_millis||yyyy-MM-dd'T'HH:mmZZ"
315
+ },
316
+ "stars" : {
317
+ "type" : "short"
318
+ }
294
319
}
295
320
}
296
321
}
@@ -304,14 +329,14 @@ It should return
304
329
[source]
305
330
----
306
331
curl -X POST localhost:9200/_aliases -H 'Content-Type: application/json' \
307
- -d '{ "actions": [{ "add": {"alias": "ecommerce.products", "index": "ecommerce.products.v1" }}]}'
332
+ -d '{ "actions": [{ "add": {"alias": "ecommerce.products", "index": "ecommerce.products.v1" }}]}'
308
333
----
309
334
+
310
335
It should return
311
336
+
312
337
[source]
313
338
----
314
- { "acknowledged":true }
339
+ {"acknowledged":true}
315
340
----
316
341
317
342
* Check aliases
@@ -325,7 +350,13 @@ It should return
325
350
+
326
351
[source]
327
352
----
328
- { "ecommerce.products.v1": { "aliases": { "ecommerce.products": {} } } }
353
+ {
354
+ "ecommerce.products.v1" : {
355
+ "aliases" : {
356
+ "ecommerce.products" : { }
357
+ }
358
+ }
359
+ }
329
360
----
330
361
331
362
* Create `ecommerce.products.v2` index
@@ -339,7 +370,7 @@ It should return
339
370
+
340
371
[source]
341
372
----
342
- { "acknowledged":true, "shards_acknowledged":true, "index":"ecommerce.products.v2" }
373
+ {"acknowledged":true,"shards_acknowledged":true,"index":"ecommerce.products.v2"}
343
374
----
344
375
+
345
376
Checking indexes again
@@ -354,8 +385,8 @@ It should return something like
354
385
[source]
355
386
----
356
387
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
357
- yellow open ecommerce.products.v2 Iq0adLgEQSaCTIOISIW4DA 1 1 0 0 230b 230b
358
- yellow open ecommerce.products.v1 1B3JXm6zQnKolob4mtwRUg 1 1 0 0 283b 283b
388
+ yellow open ecommerce.products.v2 yAC8FWpcRH28YkDux9EQYA 1 1 0 0 208b 208b
389
+ yellow open ecommerce.products.v1 1cgjRUxQQVW_uFfc3nYFcg 1 1 0 0 208b 208b
359
390
----
360
391
361
392
* Reindex from `ecommerce.products.v1` to `ecommerce.products.v2`
@@ -370,22 +401,7 @@ It should return something like
370
401
+
371
402
[source]
372
403
----
373
- {
374
- "took": 86,
375
- "timed_out": false,
376
- "total": 0,
377
- "updated": 0,
378
- "created": 0,
379
- "deleted": 0,
380
- "batches": 0,
381
- "version_conflicts": 0,
382
- "noops": 0,
383
- "retries": { "bulk": 0, "search": 0 },
384
- "throttled_millis": 0,
385
- "requests_per_second": -1.0,
386
- "throttled_until_millis": 0,
387
- "failures": []
388
- }
404
+ {"took":77,"timed_out":false,"total":0,"updated":0,"created":0,"deleted":0,"batches":0,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}
389
405
----
390
406
391
407
* Adjust alias after reindex from `ecommerce.products.v1` to `ecommerce.products.v2`
@@ -400,7 +416,7 @@ It should return
400
416
+
401
417
[source]
402
418
----
403
- { "acknowledged":true }
419
+ {"acknowledged":true}
404
420
----
405
421
+
406
422
Checking aliases again
@@ -415,8 +431,14 @@ It should return something like
415
431
[source]
416
432
----
417
433
{
418
- "ecommerce.products.v1": { "aliases": {} },
419
- "ecommerce.products.v2": { "aliases": { "ecommerce.products": {} } }
434
+ "ecommerce.products.v1" : {
435
+ "aliases" : { }
436
+ },
437
+ "ecommerce.products.v2" : {
438
+ "aliases" : {
439
+ "ecommerce.products" : { }
440
+ }
441
+ }
420
442
}
421
443
----
422
444
@@ -431,7 +453,7 @@ It should return
431
453
+
432
454
[source]
433
455
----
434
- { "acknowledged":true }
456
+ {"acknowledged":true}
435
457
----
436
458
+
437
459
Checking aliases again
@@ -445,7 +467,13 @@ It should return
445
467
+
446
468
[source]
447
469
----
448
- { "ecommerce.products.v2": { "aliases": { "ecommerce.products": {} } } }
470
+ {
471
+ "ecommerce.products.v2" : {
472
+ "aliases" : {
473
+ "ecommerce.products" : { }
474
+ }
475
+ }
476
+ }
449
477
----
450
478
451
479
* Simple search
@@ -460,13 +488,21 @@ It should return something like
460
488
[source]
461
489
----
462
490
{
463
- "took": 1,
464
- "timed_out": false,
465
- "_shards": { "total": 1, "successful": 1, "skipped": 0, "failed": 0 },
466
- "hits": {
467
- "total": { "value": 0, "relation": "eq" },
468
- "max_score": null,
469
- "hits": []
491
+ "took" : 14,
492
+ "timed_out" : false,
493
+ "_shards" : {
494
+ "total" : 1,
495
+ "successful" : 1,
496
+ "skipped" : 0,
497
+ "failed" : 0
498
+ },
499
+ "hits" : {
500
+ "total" : {
501
+ "value" : 0,
502
+ "relation" : "eq"
503
+ },
504
+ "max_score" : null,
505
+ "hits" : [ ]
470
506
}
471
507
}
472
508
----
0 commit comments