Skip to content

Commit

Permalink
update changelog and readme about the new parameter in the updateMapp…
Browse files Browse the repository at this point in the history
…ing method
  • Loading branch information
Nexucis committed Jun 23, 2019
1 parent af8fa29 commit 8b41e20
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

## [v7.0.0](https://github.com/Nexucis/es-php-index-helper/tree/7.0.0)
* Upgrade elasticsearch-php dependency version from 6.0.X to 7.0.1
* Requirement of PHP 7.1 instead of 7.0 that is not supported since 1st Jan 2019
* **[Public]** add a new parameter `$includeTypeName` in the method `updateMappings`, following the [elasticsearch recommendation](https://www.elastic.co/blog/moving-from-types-to-typeless-apis-in-elasticsearch-7-0)

## [v6.1.1](https://github.com/Nexucis/es-php-index-helper/tree/6.1.1)

### Feature
Expand All @@ -16,7 +21,7 @@ Changelog
## [v6.0.0](https://github.com/Nexucis/es-php-index-helper/tree/6.0.0)

### Feature
* Upgrade elasticsearch-php dependencie version from 5.3.1 to 6.0.0
* Upgrade elasticsearch-php dependency version from 5.3.1 to 6.0.0
* **[Public]** Add new method `deleteIndexByAlias` which cannot be taken an index as parameter

### Breaking Changes
Expand Down
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ $mappings = [
]
]
];
$helper->updateMappings($alias, $mappings);
$helper->updateMappings($alias, $mappings, false, true, true, false);
```

You just need to provide the alias name and the new mapping and that's it.
Expand All @@ -154,7 +154,34 @@ You just need to provide the alias name and the new mapping and that's it.

* With ElasticSearch `2.4`, to call this method in an asynchronous process..
* With ElasticSearch `5` or greater, to set the parameter `$waitForCompletion` to false. It will return taskID, which can then be used with the [_task api](https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html)


:warning: Elasticsearch has started to remove the document type in the mapping. Following the [recommendation](https://www.elastic.co/blog/moving-from-types-to-typeless-apis-in-elasticsearch-7-0),
the method `updateMappings` has a new parameter `$includeTypeName` which allows to support the old mapping format

By default, the method `updateMappings` will consider the old mapping format which is for example :

```php
<?php
$alias = "myindex";
$mappings = [
'my_type' => [
'properties' => [
'first_name' => [
'type' => 'text',
'analyzer' => 'standard'
],
'age' => [
'type' => 'integer'
]
]
]
];
$helper->updateMappings($alias, $mappings);
```

If you want to move to the new format, you have to remove the type in the mapping and set to false the parameter `$includeTypeName`

Please be aware that the parameter `$includeTypeName` will be removed in the next major version
### Settings Operation
Indices settings can be updated the same way as mapping using the `updateSettings` method:

Expand Down

0 comments on commit 8b41e20

Please sign in to comment.