Skip to content

Commit

Permalink
Add to the mapping properties instead of overwriting them
Browse files Browse the repository at this point in the history
The properties key of the mappings key in the mapping array already has
values provided by the ElasticPress mapping. In the old situation, that
entire key was overwritten, instead of adding the custom mappings to the
properties.
  • Loading branch information
coenjacobs committed Sep 14, 2021
1 parent 762e782 commit 35438d6
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/Base/ElasticPress/ElasticPress.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,20 +232,19 @@ protected function formatOutputForElasticsearch(array $item): array
*/
public function addMappings(array $mapping): array
{
$mapping['mappings']['properties'] = [
'expired' => [
'type' => 'object',
'properties' => [
'on' => [
'type' => 'object',
'enabled' => 'false'
]
$mapping['mappings']['properties']['expired'] = [
'type' => 'object',
'properties' => [
'on' => [
'type' => 'object',
'enabled' => 'false'
]
],
'post_date_gmt' => [
'type' => 'date',
'format' => 'yyyy-MM-dd HH:mm:ss',
],
];

$mapping['mappings']['properties']['post_date_gmt'] = [
'type' => 'date',
'format' => 'yyyy-MM-dd HH:mm:ss',
];

return $mapping;
Expand Down

0 comments on commit 35438d6

Please sign in to comment.