Skip to content
This repository was archived by the owner on Jan 26, 2024. It is now read-only.

Commit f122f55

Browse files
Added database tool chapter
1 parent 02f4b8a commit f122f55

File tree

2 files changed

+31
-13
lines changed

2 files changed

+31
-13
lines changed

docs/.vuepress/config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ module.exports = {
7777
'data/elasticsearch',
7878
'data/data-migrations',
7979
'data/elastic-queries',
80+
'data/database-tool',
81+
'data/ssr-cache',
8082
],
8183
},
8284
{

docs/guide/data/database-tool.md

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,59 @@
11
# Database tool
22

3-
Vue Storefront gets it's all data from [vue-storefront-api](https://github.com/DivanteLtd/vue-storefront-api) endpoints, operating on top of Elastic Search data store.
3+
Vue Storefront gets all its data from [vue-storefront-api](https://github.com/DivanteLtd/vue-storefront-api) endpoints, operating on top of Elastic Search data store.
4+
5+
If you installed the project using `npm run installer` command then, the database has been set up, data imported from demo-dump and everything should be just fine.
46

5-
If You installed the project using `npm run installer` command then, the database has been set up, data imported from demo-dump and everything should be just fine.
67
After some more extensive data operations - like custom imports using [mage2vuestorefront](https://github.com/DivanteLtd/mage2vuestorefront) or [magento1-vsbridge](https://github.com/DivanteLtd/magento1-vsbridge) there is a need to re-index the ElasticSearch and setup the proper metadata for fields.
78

8-
The main reason You know You must reindex the database is kind of the following error You get from vue-storefront console:
9+
The main reason you know you must reindex the database is kind of the following error you get from the `vue-storefront` console:
910

1011
```json
1112
Error: {"root_cause":[{"type":"illegal_argument_exception","reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [created_at] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"vue_storefront_catalog_1521776807","node":"xIOeZW2lTwaprGXh6YLyCA","reason":{"type":"illegal_argument_exception","reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [created_at] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."}}]}
1213
```
1314

1415
In this case there is a db tool inside your local `vue-storefront-api` installation to the rescue.
1516

16-
## Re-indexing existing database
17+
## Re-indexing an existing database
1718

1819
Please go to `vue-storefront-api` directory and run:
19-
`npm run db rebuild`
20+
21+
```bash
22+
npm run db rebuild`
23+
```
2024

2125
This command will:
2226

2327
- reindex your currently set (in the `config/local.json` config file) elastic search index to temp-one,
2428
- put the right elastic search mappings on top of the temp index,
2529
- drop the original index,
26-
- create the alias with original name to the temp one - so You can use original name without any reference chcanges.
30+
- create the alias with original name to the temp one - so You can use original name without any reference changes.
2731

2832
You can specify different (than this set in `config/local.json`) index name by running:
29-
`npm run db rebuild -- --indexName=custom_index_name`
33+
34+
```bash
35+
npm run db rebuild -- --indexName=custom_index_name
36+
```
3037

3138
## Creating the new index
3239

3340
If you like to create new, empty index please run:
34-
`npm run db new`
41+
42+
```bash
43+
npm run db new
44+
```
3545

3646
This tool will drop your current index and create new, empty one with all the metafields set.
3747

3848
You can specify different (than this set in `config/local.json`) index name by running:
39-
`npm run db rebuild -- --indexName=custom_index_name`
4049

41-
## Chaning the index structure / adding new fields / chaning the types
50+
```bash
51+
npm run db rebuild -- --indexName=custom_index_name
52+
```
53+
54+
## Changing the index structure / adding new fields / changing the types
4255

43-
If You like to extenend the ElasticSearch data structures or map some particular field types. For example after getting kind of this error:
56+
If you like to extend the ElasticSearch data structures or map some particular field types, for example after getting kind of this error:
4457

4558
```
4659
[{"type":"illegal_argument_exception","reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [created_at] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."}]
@@ -52,7 +65,10 @@ Please do change the ES schema by modifying:
5265
- [config/elastic.schema.attribute.extension.json](https://github.com/DivanteLtd/vue-storefront-api/blob/master/config/elastic.schema.attribute.extension.json)
5366
- [config/elastic.schema.taxrate.extension.json](https://github.com/DivanteLtd/vue-storefront-api/blob/master/config/elastic.schema.taxrate.extension.json)
5467
55-
The format is compliant with ES DSL for schema modifications: https://www.elastic.co/blog/found-elasticsearch-mapping-introduction
68+
The format is compliant with [ES DSL for schema modifications](https://www.elastic.co/blog/found-elasticsearch-mapping-introduction)
5669
5770
After the changes please do run the following indexing command:
58-
`npm run db rebuild`
71+
72+
```bash
73+
npm run db rebuild
74+
```

0 commit comments

Comments
 (0)