You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[elasticsearch multi get API](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html).
35
-
36
33
## Find by field
37
34
38
35
Find by field uses [query_string query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html) to fetch results by a specified field value.
@@ -42,10 +39,10 @@ Find by field uses [query_string query](https://www.elastic.co/guide/en/elastics
42
39
43
40
```php
44
41
45
-
$repo = $this->get('es.manager.default.content');
42
+
$index = $this->get('Content::class');
46
43
47
44
/** @var $content Content **/
48
-
$content = $repo->findBy(['title' => 'Acme']);
45
+
$content = $index->findBy(['title' => 'Acme']);
49
46
50
47
```
51
48
@@ -65,7 +62,7 @@ Also with `findBy` you can define the way the results are ordered, limit the amo
Welcome to the ElasticsearchBundle, the modern solution to work with [Elasticsearch database](https://www.elastic.co/products/elasticsearch) in the [Symfony](https://github.com/symfony/symfony-standard) applications. We created this bundle with love :heart: and we think you will love it too.
7
+
> This documentation is for **`6.x`** version. If you look for **`5.x`** or earlier take a look at the [Github Resources folder](https://github.com/ongr-io/ElasticsearchBundle/tree/5.2/Resources/doc).
8
+
9
+
## Reference links
4
10
5
-
> Bundle set up guide you can find in the `README.md` file.
11
+
Welcome to the ElasticsearchBundle, the modern solution to work with [Elasticsearch database](https://www.elastic.co/products/elasticsearch)in the [Symfony](https://github.com/symfony/symfony-standard) applications. We created this bundle with love :heart: and we think you will love it too.
6
12
7
-
#### Usage
8
13
*[Mapping explained](mapping.md)
9
14
*[Using Meta-Fields](meta_fields.md)
10
15
*[Configuration](configuration.md)
@@ -15,15 +20,100 @@ Welcome to the ElasticsearchBundle, the modern solution to work with [Elasticsea
15
20
*[Scan through the index](scan.md)
16
21
*[Parsing the results](results_parsing.md)
17
22
18
-
#### Troubleshooting
19
-
*[How to upgrade from the older versions?](upgrade.md)
20
-
*[How to overwrite some parts of the bundle?](overwriting_bundle.md)
23
+
## How to install
24
+
25
+
#### Step 1: Install Elasticsearch bundle
26
+
27
+
Elasticsearch bundle is installed using [Composer](https://getcomposer.org).
28
+
29
+
```bash
30
+
composer require ongr/elasticsearch-bundle "~6.0"
31
+
```
32
+
33
+
> Instructions for installing and deploying Elasticsearch can be found in
34
+
[Elasticsearch installation page][17].
35
+
36
+
Enable Elasticsearch bundle in your AppKernel:
37
+
38
+
```php
39
+
// app/AppKernel.php
40
+
41
+
public function registerBundles()
42
+
{
43
+
$bundles = [
44
+
// ...
45
+
new ONGR\ElasticsearchBundle\ONGRElasticsearchBundle(),
46
+
];
47
+
48
+
// ...
49
+
}
50
+
51
+
```
52
+
53
+
#### Step 2: (OPTIONAL) Add configuration
54
+
55
+
> Since bundle v6 the configuration is not necessary. Everything can be set through annotation.
56
+
57
+
```yaml
58
+
# app/config/config.yml
59
+
ongr_elasticsearch:
60
+
indexes:
61
+
App\Document\Product:
62
+
alias: product
63
+
hosts:
64
+
- 127.0.0.1:9200
65
+
```
66
+
67
+
The configuration might be handy if you want to set an index alias name or other parameter from `.env` or ENV.
68
+
69
+
70
+
#### Step 3: Define your Elasticsearch types as `Document` objects
71
+
72
+
This bundle uses objects to represent Elasticsearch documents. Lets create a `Product` class to represent products.
73
+
74
+
```php
75
+
// src/Document/Product.php
76
+
77
+
namespace App\Document;
78
+
79
+
use ONGR\ElasticsearchBundle\Annotation as ES;
80
+
81
+
/**
82
+
* @ES\Index(alias="my_product")
83
+
*/
84
+
class Product
85
+
{
86
+
/**
87
+
* @ES\Id()
88
+
*/
89
+
public $id;
90
+
91
+
/**
92
+
* @ES\Property(type="text")
93
+
*/
94
+
public $title;
95
+
96
+
/**
97
+
* @ES\Property(type="float")
98
+
*/
99
+
public $price;
100
+
}
101
+
102
+
```
103
+
104
+
#### Step 4: Create index and mappings
105
+
106
+
Elasticsearch bundle provides several `CLI` commands. One of them is for creating index, run command in your terminal:
107
+
108
+
```bash
109
+
110
+
bin/console ongr:es:index:create
111
+
112
+
```
113
+
114
+
> More info about the rest of the commands can be found in the [commands chapter][10].
21
115
22
-
#### Some news for upcoming versions
23
116
24
-
We already have a new milestone set for v1.1.0 version (see active milestones [here](https://github.com/ongr-io/ElasticsearchBundle/milestones)). For the new milestone we are planning to support new endpoints:
25
-
* Highlight
26
-
* Autocomplete
27
-
* Suggestions
117
+
#### Step 5: Enjoy the ElasticsearchBundle
28
118
29
-
We are hoping that those features will help our community to create better projects. **If you think that we are missing something very important which would help you, please do not hesitate to create an issue and ask about it.** We are very open and looking forward to see a projects running on this awesome bundle :smirk:.
0 commit comments