diff --git a/core/elasticsearch.md b/core/elasticsearch.md index 7e5f931720b..cfd334f7b41 100644 --- a/core/elasticsearch.md +++ b/core/elasticsearch.md @@ -18,7 +18,9 @@ To enable the reading support for Elasticsearch, simply require the Elasticsearc composer require elasticsearch/elasticsearch:^7.11 ``` -Then, enable it inside the API Platform configuration: +Then, enable it inside the API Platform configuration, using one of the configurations below: + +### Enabling Reading Support using Symfony ```yaml # api/config/packages/api_platform.yaml @@ -38,12 +40,32 @@ api_platform: #... ``` +### Enabling Reading Support using Laravel + +```php + [ + 'paths' => [ + base_path('app/Models'), + ], + ], + 'elasticsearch' => [ + 'hosts' => [ + env('ELASTICSEARCH_HOST', 'http://localhost:9200'), + ], + ], +]; +``` + ## Creating Models API Platform follows the best practices of Elasticsearch: -- a single index per resource should be used because Elasticsearch is going to [drop support for index types and will allow only a single type per - index](https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html); +- a single index per resource should be used because Elasticsearch is going to [drop support for index types and will +allow only a single type per index](https://www.elastic.co/guide/en/elasticsearch/reference/current/removal-of-types.html); - index name should be the short resource name in lower snake_case; - the default `_doc` type should be used; - all fields should be lower case and should use camelCase for combining words. @@ -143,7 +165,7 @@ Here is an example of mappings for 2 resources, `User` and `Tweet`, and their mo ```php