File tree Expand file tree Collapse file tree
tests/SpameriTests/Data/Config Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+
Original file line number Diff line number Diff line change @@ -13,19 +13,19 @@ Monolog is required by elasticsearch/elasticsearch and we can use existing exten
1313
1414``` neon
1515extensions:
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
2121Then 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.
Original file line number Diff line number Diff 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 `
1414continuing 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
2525all fields introduced and specify their type. But if your application can add fields as needed you need to remember this
2626strict 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
3434and 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:
Original file line number Diff line number Diff line change 11extensions :
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
Original file line number Diff line number Diff line change 1- elasticSearch :
1+ spameriElasticSearch :
22 entities :
33 Person :
44 index : spameri_person
Original file line number Diff line number Diff line change 1- elasticSearch :
1+ spameriElasticSearch :
22 entities :
33 Video :
44 index : spameri_video
You can’t perform that action at this time.
0 commit comments