Skip to content

Commit 98de222

Browse files
committed
QuickStart guide - Register extension
1 parent 63f5269 commit 98de222

6 files changed

Lines changed: 46 additions & 11 deletions

File tree

doc/00_quick_start.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Quick Start
2+
3+
## 1. Install
4+
5+
Use composer to install this library.
6+
```bash
7+
composer require spameri/elastic
8+
```
9+
10+
## 2. Configure
11+
12+
You need to set up few things first, before you can dive into ElasticSearch.
13+
14+
### I. Register extension
15+
16+
In your configuration neon file you need to add these lines to `extension:` section.
17+
18+
```yaml
19+
extensions:
20+
spameriElasticSearch: \Spameri\Elastic\DI\SpameriElasticSearchExtension
21+
console: Kdyby\Console\DI\ConsoleExtension
22+
monolog: Kdyby\Monolog\DI\MonologExtension
23+
```
24+
25+
26+
27+
28+
29+
30+
31+
32+
33+
34+
35+

doc/01_intro.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ Monolog is required by elasticsearch/elasticsearch and we can use existing exten
1313

1414
```neon
1515
extensions:
16-
elasticSearch: \Spameri\Elastic\DI\ElasticSearchExtension
16+
spameriElasticSearch: \Spameri\Elastic\DI\SpameriElasticSearchExtension
1717
console: Kdyby\Console\DI\ConsoleExtension
1818
monolog: Kdyby\Monolog\DI\MonologExtension
1919
```
2020

2121
Then configure where is your ElasticSearch.
2222
```neon
23-
elasticSearch:
23+
spameriElasticSearch:
2424
host: 127.0.0.1
2525
port: 9200
2626
```
2727

28-
For more config options see default values in `\Spameri\Elastic\DI\ElasticSearchExtension::$defaults`. [Here](../src/DI/ElasticSearchExtension.php#L9).
28+
For more config options see default values in `\Spameri\Elastic\DI\SpameriElasticSearchExtension::$defaults`. [Here](../src/DI/ElasticSearchExtension.php#L9).
2929

3030
#### Raw client usage
3131
- After this configuration you are ready to use ElasticSearch in your Nette application.

doc/02_neon_configuration.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ have to worry about it because of type deprecation. More details here https://ww
1313
- Entity definition is in neon under namespace `elasticSearch.entities.EntityName`
1414
continuing our example in file `app/ProductModule/Config/Product.neon`:
1515
```neon
16-
elasticSearch:
16+
spameriElasticSearch:
1717
entities:
1818
Product:
1919
index: shop_product
@@ -25,15 +25,15 @@ This means newly introduced fields not specified in mapping will throw error whe
2525
all fields introduced and specify their type. But if your application can add fields as needed you need to remember this
2626
strict limitation or just do not enable it.
2727
```neon
28-
elasticSearch:
28+
spameriElasticSearch:
2929
entities:
3030
Product:
3131
dynamic: strict
3232
```
3333
- Now to specify entity mapping. Each object or encapsulation of sub fields stars with `properties:` then property name
3434
and under it you can specify type and analyzer.
3535
```neon
36-
elasticSearch:
36+
spameriElasticSearch:
3737
entities:
3838
Product:
3939
properties:
@@ -46,7 +46,7 @@ elasticSearch:
4646
- ElasticSearch default analyzers: https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-analyzers.html
4747
- Subfields example:
4848
```neon
49-
elasticSearch:
49+
spameriElasticSearch:
5050
entities:
5151
Product:
5252
properties:

tests/SpameriTests/Data/Config/Common.neon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
extensions:
2-
elasticSearch: Spameri\Elastic\DI\ElasticSearchExtension
2+
spameriElasticSearch: Spameri\Elastic\DI\SpameriElasticSearchExtension
33

4-
elasticSearch:
4+
spameriElasticSearch:
55
host: 127.0.0.1
66
port: 9200
77

tests/SpameriTests/Data/Config/Person.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
elasticSearch:
1+
spameriElasticSearch:
22
entities:
33
Person:
44
index: spameri_person

tests/SpameriTests/Data/Config/Video.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
elasticSearch:
1+
spameriElasticSearch:
22
entities:
33
Video:
44
index: spameri_video

0 commit comments

Comments
 (0)