Skip to content

Commit 9fe0fa4

Browse files
author
Simonas Šerlinskas
committed
update the readme
1 parent 0ea826b commit 9fe0fa4

File tree

1 file changed

+80
-83
lines changed

1 file changed

+80
-83
lines changed

README.md

Lines changed: 80 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ Elasticsearch Bundle was created in order to serve the need for
44
professional [Elasticsearch][1] integration with enterprise level Symfony
55
applications. This bundle is:
66

7-
* Supported by [ONGR.io][2] development team.
8-
* Uses the official [elasticsearch-php][3] client.
9-
* Ensures full integration with Symfony framework.
7+
* Uses the official [elasticsearch-php][2] client.
8+
* Ensures full integration with Symfony framework and Symfony Flex.
109

1110
Technical goodies:
1211

13-
* Provides interactive Document object generator via CLI (`ongr:es:document:generate`)
14-
* Provides DSL query builder to be executed by type repository services.
15-
* Uses Doctrine-like documents(entities) document-object mapping using annotations.
16-
* Query results iterators are provided for your convenience.
17-
* Console CLI commands for index and types management and data import / export.
12+
* Provides a DSL query builder which represent all ElasticSearch endpoints in the objective way.
13+
* Provides interactive Document object generator via CLI command (`ongr:es:document:generate`)
14+
* Creates a familiar Doctrine-like way to work with documents(entities) document-object mapping using annotations.
15+
* Several query results iterators are provided for your convenience to work with results.
16+
* Console CLI commands for the index management and data import/export/reindex.
1817
* Profiler that integrates in the Symfony debug bar and shows all executed queries.
1918
* Designed in an extensible way for all your custom needs.
19+
* Supports Symfony FLEX.
2020

21-
If you need any help, [stack overflow][4]
21+
If you need any help, [stack overflow][3] is the preferred way to get answers.
2222
is the preferred and recommended way to ask questions about ONGR bundles and libraries.
2323

2424

@@ -31,46 +31,44 @@ is the preferred and recommended way to ask questions about ONGR bundles and lib
3131

3232
## Version matrix
3333

34-
| Elasticsearch version | ElasticsearchBundle version |
35-
| --------------------- | --------------------------- |
36-
| >= 5.0 | ~5.x |
37-
| >= 2.0, < 5.0 | >=1.0, < 5.0 |
38-
| >= 1.0, < 2.0 | >= 0.10, < 1.0 |
39-
| <= 0.90.x | < 0.10 |
34+
| Elasticsearch version | ElasticsearchBundle version |
35+
| --------------------- | -------------------------------- |
36+
| >= 6.0 | ~6.x |
37+
| >= 5.0, < 5.0 | ~5.x, ~6.x (indexes with 1 type) |
38+
| >= 2.0, < 5.0 | >=1.0, < 5.0 |
39+
| >= 1.0, < 2.0 | >= 0.10, < 1.0 |
40+
| <= 0.90.x | < 0.10 |
4041

4142
## Documentation
4243

43-
The online documentation of the bundle can be found in [http://docs.ongr.io][5].
44-
Docs source is stored within the repo under `Resources/doc/`, so if you see a typo or problem, please submit a PR to fix it!
44+
The online documentation of the bundle can be found in [http://docs.ongr.io][4].
45+
Docs source is stored within the repo under `Resources/doc/`, so if you see a typo or some inaccuracy, please submit a PR or at least an issue to fix it!
4546

46-
For contribution to the documentation you can find it in the [contribute][6] topic.
47+
*For contribution to the documentation you can find it in the [contribute][5] topic.*
4748

4849
## FAQ
49-
* [Mapping explained][7]
50-
* [Using Meta-Fields][8]
51-
* [Configuration][9]
52-
* [Console commands][10]
53-
* [How to do a simple CRUD actions][11]
54-
* [Quick find functions][12]
55-
* [How to search the index][13]
56-
* [Scan through the index][14]
57-
* [Parsing the results][15]
50+
* [Index mapping][6]
51+
* [Configuration][7]
52+
* [Console commands][8]
53+
* [How to do simple CRUD actions][9]
54+
* [Quick find functions][10]
55+
* [How to execute search in the index][11]
56+
* [Parsing the results][12]
5857

5958
## Setup the bundle
6059

6160
#### Step 1: Install Elasticsearch bundle
6261

63-
Elasticsearch bundle is installed using [Composer][16].
62+
Elasticsearch bundle is installed using [Composer][13].
6463

6564
```bash
66-
php composer.phar require ongr/elasticsearch-bundle "~5.0"
67-
65+
php composer.phar require ongr/elasticsearch-bundle "~6.0"
6866
```
6967

7068
> Instructions for installing and deploying Elasticsearch can be found in
71-
[Elasticsearch installation page][17].
69+
[Elasticsearch installation page][14].
7270

73-
Enable Elasticsearch bundle in your AppKernel:
71+
Enable ElasticSearch bundle in your AppKernel:
7472

7573
```php
7674
// app/AppKernel.php
@@ -87,33 +85,35 @@ public function registerBundles()
8785

8886
```
8987

90-
#### Step 2: Add configuration
88+
#### (OPTIONAL) Step 2: Add configuration
9189

9290
Add minimal configuration for Elasticsearch bundle.
9391

9492
```yaml
9593

9694
# app/config/config.yml
97-
9895
ongr_elasticsearch:
99-
managers:
100-
default:
101-
index:
102-
index_name: acme
103-
mappings:
104-
- AppBundle
96+
analysis:
97+
filter:
98+
edge_ngram_filter: #-> your custom filter name to use in the analyzer below
99+
type: edge_ngram
100+
min_gram: 1
101+
max_gram: 20
102+
analyzer:
103+
eNgramAnalyzer: #-> analyzer name to use in the document field
104+
type: custom
105+
tokenizer: standard
106+
filter:
107+
- lowercase
108+
- edge_ngram_filter #that's the filter defined earlier
105109

106110
```
107111

108112
> This is the very basic example only, for more information, please take a look at the [configuration][9] chapter.
109113
110-
In this particular example there are 2 things you should know. The index name in the index node and the mappings.
111-
Mappings is the place where your documents are stored (more info at [the mapping chapter][7]).
112-
113-
114114
#### Step 3: Define your Elasticsearch types as `Document` objects
115115

116-
This bundle uses objects to represent Elasticsearch documents. Lets create a `Customer` class for customer document.
116+
This bundle uses objects to represent Elasticsearch documents. Lets create the `Product` class for the `products` index.
117117

118118
```php
119119
// src/AppBundle/Document/Customer.php
@@ -123,77 +123,74 @@ namespace AppBundle\Document;
123123
use ONGR\ElasticsearchBundle\Annotation as ES;
124124

125125
/**
126-
* @ES\Document()
126+
* //alias and default parameters in the annotation are optional.
127+
* @ES\Document(alias="products", default=true)
127128
*/
128-
class Customer
129+
class Product
129130
{
130131
/**
131-
* @var string
132-
*
133132
* @ES\Id()
134133
*/
135134
public $id;
136135

137136
/**
138-
* @var string
139-
*
140-
* @ES\Property(type="text")
137+
* @ES\Property(type="text", "analyzer"="eNgramAnalyzer")
141138
*/
142-
public $name;
139+
public $title;
140+
141+
/**
142+
* @ES\Property(type="float")
143+
*/
144+
public $price;
143145
}
144146

145147
```
146148

147-
> This is the basic example only, for more information about mapping, please take a look
148-
at the [the mapping chapter][7].
149+
> This is the basic example only, for more information about a mapping, please take a look
150+
at the [the mapping chapter][6].
149151

150152

151153
#### Step 4: Create index and mappings
152154

153-
Elasticsearch bundle provides several `CLI` commands. One of them is for creating index, run command in your terminal:
155+
Elasticsearch bundle provides several `CLI` commands. One of them is for creating an index, run the command in your terminal:
154156

155157
```bash
156158

157159
bin/console ongr:es:index:create
158160

159161
```
162+
Now the `products` index should be created with fields from your document.
160163

161-
> More info about the rest of the commands can be found in the [commands chapter][10].
164+
> More info about the rest of the commands can be found in the [commands chapter][8].
162165
163166

164167
#### Step 5: Enjoy with the Elasticsearch
165168

166-
We advise to take a look at the [mapping chapter][7] to configure the index.
167-
Search documentation for the Elasticsearch bundle is [available here][13].
168-
And finally it's up to you what amazing things you are going to create :sunglasses: .
169+
Full documentation for the Elasticsearch bundle is [available here][4].
170+
I hope you will create amazing things with it :sunglasses: .
169171

170172
## Troubleshooting
171-
* [How to upgrade from the older versions?][18]
172-
* [How to overwrite some parts of the bundle?][19]
173+
* [How to upgrade from the older versions?][15]
174+
* [How to overwrite some parts of the bundle?][16]
173175

174176
## License
175177

176-
This bundle is licensed under the MIT license. Please, see the complete license
178+
This bundle is licensed under the [MIT license](LICENSE). Please, see the complete license
177179
in the bundle `LICENSE` file.
178180

179-
180-
181181
[1]: https://www.elastic.co/products/elasticsearch
182-
[2]: http://ongr.io
183-
[3]: https://github.com/elastic/elasticsearch-php
184-
[4]: http://stackoverflow.com/questions/tagged/ongr
185-
[5]: http://docs.ongr.io/ElasticsearchBundle
186-
[6]: http://docs.ongr.io/common/Contributing
187-
[7]: http://docs.ongr.io/ElasticsearchBundle/mapping
188-
[8]: http://docs.ongr.io/ElasticsearchBundle/meta_fields
189-
[9]: http://docs.ongr.io/ElasticsearchBundle/configuration
190-
[10]: http://docs.ongr.io/ElasticsearchBundle/commands
191-
[11]: http://docs.ongr.io/ElasticsearchBundle/crud
192-
[12]: http://docs.ongr.io/ElasticsearchBundle/find_functions
193-
[13]: http://docs.ongr.io/ElasticsearchBundle/search
194-
[14]: http://docs.ongr.io/ElasticsearchBundle/scan
195-
[15]: http://docs.ongr.io/ElasticsearchBundle/results_parsing
196-
[16]: https://getcomposer.org
197-
[17]: https://www.elastic.co/downloads/elasticsearch
198-
[18]: http://docs.ongr.io/ElasticsearchBundle/upgrade
199-
[19]: http://docs.ongr.io/ElasticsearchBundle/overwriting_bundle
182+
[2]: https://github.com/elastic/elasticsearch-php
183+
[3]: http://stackoverflow.com/questions/tagged/ongr
184+
[4]: http://docs.ongr.io/ElasticsearchBundle
185+
[5]: http://docs.ongr.io/common/Contributing
186+
[6]: http://docs.ongr.io/ElasticsearchBundle/mapping
187+
[7]: http://docs.ongr.io/ElasticsearchBundle/configuration
188+
[8]: http://docs.ongr.io/ElasticsearchBundle/commands
189+
[9]: http://docs.ongr.io/ElasticsearchBundle/crud
190+
[10]: http://docs.ongr.io/ElasticsearchBundle/find_functions
191+
[11]: http://docs.ongr.io/ElasticsearchBundle/search
192+
[12]: http://docs.ongr.io/ElasticsearchBundle/results_parsing
193+
[13]: https://getcomposer.org
194+
[14]: https://www.elastic.co/downloads/elasticsearch
195+
[15]: http://docs.ongr.io/ElasticsearchBundle/upgrade
196+
[16]: http://docs.ongr.io/ElasticsearchBundle/overwriting_bundle

0 commit comments

Comments
 (0)