Skip to content

Commit fe201ff

Browse files
committed
es8 fix multisearch formating and bulk update/delete
1 parent 58d1d87 commit fe201ff

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/Engine/Elasticsearch/ElasticsearchAdapter.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function select(CollectionNameInterface $collectionName, SelectionFactory
134134
*/
135135
public function multiSelect(CollectionNameInterface $collectionName, array $data)
136136
{
137-
$queries = $this->getQueries($data);
137+
$queries = $this->formatMultiSearchQueries($data);
138138

139139
$body = $this->formatMultiSearchBody($queries);
140140

@@ -296,7 +296,7 @@ private function prepareBulkUpdateData(IdentifiableMapperInterface ...$mappings)
296296
$data[] = [
297297
self::ELASTIC_BULK_ACTION_UPDATE => [
298298
self::ELASTIC_PARAM_ID => $mapping->getId(),
299-
self::ELASTIC_PAYLOAD_INDEX => $this->client->getIndex(),
299+
self::ELASTIC_PAYLOAD_INDEX => (string) $this->client->getIndex(),
300300
]
301301
];
302302
$data[] = [
@@ -323,7 +323,7 @@ private function prepareBulkDeleteData(IdentifiableMapperInterface ...$mappings)
323323
$data[] = [
324324
self::ELASTIC_BULK_ACTION_DELETE => [
325325
self::ELASTIC_PARAM_ID => $mapping->getId(),
326-
self::ELASTIC_PAYLOAD_INDEX => $this->client->getIndex(),
326+
self::ELASTIC_PAYLOAD_INDEX => (string) $this->client->getIndex(),
327327
]
328328
];
329329
}
@@ -342,14 +342,14 @@ public function simpleQuery($query)
342342

343343
/** @param SelectionFactoryInterface[] $listOfEsSelectionFactories
344344
*/
345-
private function getQueries(array $listOfEsSelectionFactories)
345+
private function formatMultiSearchQueries(array $listOfEsSelectionFactories)
346346
{
347347
$queries = [];
348348

349349
/** @var ElasticsearchSelectionFactory $selectionFactory */
350350

351351
foreach ($listOfEsSelectionFactories as $selectionFactory) {
352-
$queries[] = json_encode($this->getBody($selectionFactory), true);
352+
$queries[] = '{}' . PHP_EOL . json_encode($this->getBody($selectionFactory), true);
353353
}
354354
return $queries;
355355
}
@@ -366,7 +366,7 @@ private function formatMultiData(array $data)
366366

367367
private function formatMultiSearchBody(array $queries)
368368
{
369-
return PHP_EOL . '{}' . PHP_EOL . implode(PHP_EOL . '{}' . PHP_EOL, $queries) . PHP_EOL;
369+
return implode(PHP_EOL, $queries) . PHP_EOL;
370370
}
371371

372372
private function getBody(SelectionFactoryInterface $selectionFactory)

0 commit comments

Comments
 (0)