Skip to content

Commit 0f4b9af

Browse files
author
Mantas Marcinkevicius
committed
copied the doc files from docs repo
1 parent cf7d16c commit 0f4b9af

File tree

9 files changed

+248
-248
lines changed

9 files changed

+248
-248
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ is the preferred and recommended way to ask questions about ONGR bundles and lib
2323

2424

2525
[![Build Status](https://travis-ci.org/ongr-io/ElasticsearchBundle.svg?branch=master)](https://travis-ci.org/ongr-io/ElasticsearchBundle)
26-
[![Coverage Status](https://coveralls.io/repos/ongr-io/ElasticsearchBundle/badge.svg?branch=master&service=github)](https://coveralls.io/github/ongr-io/ElasticsearchBundle?branch=master)
2726
[![Latest Stable Version](https://poser.pugx.org/ongr/elasticsearch-bundle/v/stable)](https://packagist.org/packages/ongr/elasticsearch-bundle)
2827
[![Total Downloads](https://poser.pugx.org/ongr/elasticsearch-bundle/downloads)](https://packagist.org/packages/ongr/elasticsearch-bundle)
2928
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/ongr-io/ElasticsearchBundle/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/ongr-io/ElasticsearchBundle/?branch=master)

Resources/doc/find_functions.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ Find by id will execute [elasticsearch get query](https://www.elastic.co/guide/e
1010

1111
```php
1212

13-
$repo = $this->get('es.manager.default.content');
13+
$index = $this->get('Content::class');
1414

1515
/** @var $content Content **/
16-
$content = $repo->find(1); // 5 is the document _uid in the elasticsearch.
16+
$content = $index->find(1); // 5 is the document _uid in the elasticsearch.
1717

1818
```
1919

@@ -26,13 +26,10 @@ and returns `DocumentIterator` with found documents:
2626

2727
```php
2828

29-
$documents = $repo->findByIds(['26', '8', '11']);
29+
$documents = $index->findByIds(['26', '8', '11']);
3030

3131
```
3232

33-
For this functionality the `Repository` uses
34-
[elasticsearch multi get API](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html).
35-
3633
## Find by field
3734

3835
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
4239

4340
```php
4441

45-
$repo = $this->get('es.manager.default.content');
42+
$index = $this->get('Content::class');
4643

4744
/** @var $content Content **/
48-
$content = $repo->findBy(['title' => 'Acme']);
45+
$content = $index->findBy(['title' => 'Acme']);
4946

5047
```
5148

@@ -65,7 +62,7 @@ Also with `findBy` you can define the way the results are ordered, limit the amo
6562

6663
```php
6764

68-
$content = $repo->findBy(['title' => 'Acme'], ['price' => 'asc'], 20, 10);
65+
$content = $index->findBy(['title' => 'Acme'], ['price' => 'asc'], 20, 10);
6966

7067
```
7168

@@ -77,10 +74,10 @@ Completely the same as `findBy()` function, except it will return the first docu
7774

7875
```php
7976

80-
$repo = $this->get('es.manager.default.content');
77+
$index = $this->get('Content::class');
8178

8279
/** @var $content Content **/
83-
$content = $repo->findOneBy(['title' => 'Acme']);
80+
$content = $index->findOneBy(['title' => 'Acme']);
8481

8582
```
8683

Resources/doc/index.md

Lines changed: 103 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
## Elasticsearch Bundle
1+
---
2+
title: Introduction
3+
type: elasticsearch-bundle
4+
order: 1
5+
---
26

3-
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
410

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.
612

7-
#### Usage
813
* [Mapping explained](mapping.md)
914
* [Using Meta-Fields](meta_fields.md)
1015
* [Configuration](configuration.md)
@@ -15,15 +20,100 @@ Welcome to the ElasticsearchBundle, the modern solution to work with [Elasticsea
1520
* [Scan through the index](scan.md)
1621
* [Parsing the results](results_parsing.md)
1722

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].
21115

22-
#### Some news for upcoming versions
23116

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
28118

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:.
119+
Enjoy :rocket:

0 commit comments

Comments
 (0)