Skip to content

Commit a324a22

Browse files
authored
Merge pull request #3 from Spameri/doc
Documentation
2 parents d1b09ed + 6e4cab7 commit a324a22

23 files changed

+1378
-52
lines changed

doc/00_quick_start.md

Lines changed: 454 additions & 0 deletions
Large diffs are not rendered by default.

doc/01_intro.md

Lines changed: 60 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,49 +11,92 @@ Use composer `composer require spameri/elastic`
1111
In your config neon, enable extensions. Kdyby/Console is there because we need it to do some command line commands.
1212
Monolog is required by elasticsearch/elasticsearch and we can use existing extension in Kdyby/Monolog.
1313

14-
```
14+
```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.
22-
```
23-
elasticSearch:
22+
```neon
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`.
28+
For more config options see default values in `\Spameri\Elastic\DI\SpameriElasticSearchExtension::$defaults`. [Here](../src/DI/ElasticSearchExtension.php#L9).
29+
30+
#### Raw client usage
31+
- After this configuration you are ready to use ElasticSearch in your Nette application.
32+
- Where needed just inject `\Spameri\Elastic\ClientProvider` and then directly call what you need, like this:
33+
```php
34+
$result = $this->clientProvider->client()->search(
35+
(
36+
new \Spameri\ElasticQuery\Document(
37+
$index,
38+
new \Spameri\ElasticQuery\Document\Body\Plain(
39+
$elasticQuery->toArray()
40+
),
41+
$index
42+
)
43+
)->toArray()
44+
);
45+
```
46+
- [Client](https://github.com/elastic/elasticsearch-php/blob/master/src/Elasticsearch/Client.php) is provided from **elasticsearch/elasticsearch** and you can see their [documentation](https://github.com/elastic/elasticsearch-php#quickstart)
47+
what methods and arrays are supported.
48+
- When in doubt what how many arrays or how many arguments **match** supports use [Spameri/ElasticQuery](https://github.com/Spameri/ElasticQuery/blob/master/doc/02-query-objects.md)
49+
- This is library used in later examples. But direct approach is also possible.
50+
51+
---
2952

3053
### 2. First entity
3154

32-
#### [Neon file configuration](../blob/master/doc/02_neon_configuration.md)
55+
#### [Neon file configuration](02_neon_configuration.md)
56+
57+
#### [Create entity class](03_entity_class.md)
3358

34-
#### [Create Entity class](../blob/master/doc/03_entity_class.md)
59+
#### [Create entity service](12_entity_service.md)
60+
61+
#### [Create entity factory](11_entity_factory.md)
62+
63+
---
3564

3665
### 3. Mapping
3766

38-
#### [Create new index with mapping]((../blob/master/doc/05_new_index_with_mapping.md))
67+
#### [Create new index with mapping](05_new_index_with_mapping.md)
68+
69+
---
3970

4071
### 4. Fill with data
41-
TODO
72+
73+
#### [Create and save entity](06_fill_data.md)
74+
75+
#### [Saving process explained](07_save_explained.md)
76+
77+
---
4278

4379
### 5. Get data from ElasticSearch
44-
TODO Tady factories
45-
TODO
46-
TODO
47-
TODO
48-
TODO
80+
81+
#### [Get data by ID](08_basic_get.md)
82+
83+
#### [Get data by tag](13_advanced_get.md)
84+
85+
---
4986

5087
### 6. Filter data from ElasticSearch
51-
TODO
88+
89+
#### [Match data](09_match_get.md)
90+
91+
---
5292

5393
### 7. Aggregate data from ElasticSearch
54-
TODO
94+
95+
#### [Aggregate data](10_aggregate.md)
96+
97+
---
5598

5699
### x. Other
57100

58-
#### [Data interfaces]((../blob/master/doc/04_data_interfaces.md))
101+
#### [Data interfaces](04_data_interfaces.md)
59102

doc/02_neon_configuration.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Define structure in neon file
2+
TODO convert to video example
23

34
- Create neon file for example in `app/ProductModule/Config/Product.neon`
45
- Import created file to your application config neon. Usually located in`app/config/config.neon`.
@@ -12,7 +13,7 @@ have to worry about it because of type deprecation. More details here https://ww
1213
- Entity definition is in neon under namespace `elasticSearch.entities.EntityName`
1314
continuing our example in file `app/ProductModule/Config/Product.neon`:
1415
```neon
15-
elasticSearch:
16+
spameriElasticSearch:
1617
entities:
1718
Product:
1819
index: shop_product
@@ -24,15 +25,15 @@ This means newly introduced fields not specified in mapping will throw error whe
2425
all fields introduced and specify their type. But if your application can add fields as needed you need to remember this
2526
strict limitation or just do not enable it.
2627
```neon
27-
elasticSearch:
28+
spameriElasticSearch:
2829
entities:
2930
Product:
3031
dynamic: strict
3132
```
3233
- Now to specify entity mapping. Each object or encapsulation of sub fields stars with `properties:` then property name
3334
and under it you can specify type and analyzer.
3435
```neon
35-
elasticSearch:
36+
spameriElasticSearch:
3637
entities:
3738
Product:
3839
properties:
@@ -45,7 +46,7 @@ elasticSearch:
4546
- ElasticSearch default analyzers: https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-analyzers.html
4647
- Subfields example:
4748
```neon
48-
elasticSearch:
49+
spameriElasticSearch:
4950
entities:
5051
Product:
5152
properties:

0 commit comments

Comments
 (0)