Skip to content

Commit 35f3ae0

Browse files
committed
TASK: Change _type usages to _neosType property
1 parent e40b81f commit 35f3ae0

4 files changed

Lines changed: 11 additions & 9 deletions

File tree

Classes/Driver/Version5/DocumentDriver.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Driver\DocumentDriverInterface;
1919
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Driver\NodeTypeMappingBuilderInterface;
2020
use Flowpack\ElasticSearch\Domain\Model\Index;
21+
use Flowpack\ElasticSearch\Domain\Model\Mapping;
2122
use Neos\ContentRepository\Domain\Model\NodeInterface;
2223
use Neos\ContentRepository\Domain\Model\NodeType;
2324
use Neos\Flow\Annotations as Flow;
@@ -54,6 +55,7 @@ public function delete(NodeInterface $node, string $identifier): array
5455
/**
5556
* {@inheritdoc}
5657
* @throws \Flowpack\ElasticSearch\Exception
58+
* @throws \Neos\Flow\Http\Exception
5759
*/
5860
public function deleteDuplicateDocumentNotMatchingType(Index $index, string $documentIdentifier, NodeType $nodeType): void
5961
{
@@ -68,18 +70,17 @@ public function deleteDuplicateDocumentNotMatchingType(Index $index, string $doc
6870
],
6971
'must_not' => [
7072
'term' => [
71-
'_type' => $this->nodeTypeMappingBuilder->convertNodeTypeNameToMappingName($nodeType->getName())
73+
Mapping::NEOS_TYPE_FIELD => $this->nodeTypeMappingBuilder->convertNodeTypeNameToMappingName($nodeType->getName())
7274
]
7375
]
7476
]
7577
]
7678
]));
7779
$treatedContent = $result->getTreatedContent();
7880
$scrollId = $treatedContent['_scroll_id'];
79-
$mapHitToDeleteRequest = function ($hit) {
81+
$mapHitToDeleteRequest = static function ($hit) {
8082
return json_encode([
8183
'delete' => [
82-
'_type' => $hit['_type'],
8384
'_id' => $hit['_id']
8485
]
8586
]);

Classes/Driver/Version5/IndexerDriver.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function document(string $indexName, NodeInterface $node, ElasticSearchDo
4141
return [
4242
[
4343
'update' => [
44-
'_type' => $document->getType()->getName(),
44+
'_type' => '_doc',
4545
'_id' => $document->getId(),
4646
'_index' => $indexName,
4747
'_retry_on_conflict' => 3
@@ -70,8 +70,9 @@ public function document(string $indexName, NodeInterface $node, ElasticSearchDo
7070
return [
7171
[
7272
'index' => [
73-
'_type' => $document->getType()->getName(),
74-
'_id' => $document->getId()
73+
'_type' => '_doc',
74+
'_id' => $document->getId(),
75+
'_index' => $indexName,
7576
]
7677
],
7778
$documentData
@@ -112,7 +113,7 @@ public function fulltext(NodeInterface $node, array $fulltextIndexOfNode, string
112113
return [
113114
[
114115
'update' => [
115-
'_type' => $this->nodeTypeMappingBuilder->convertNodeTypeNameToMappingName($closestFulltextNode->getNodeType()->getName()),
116+
'_type' => '_doc',
116117
'_id' => $closestFulltextNodeDocumentIdentifier
117118
]
118119
],

Classes/Driver/Version5/RequestDriver.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ public function bulk(Index $index, $request): array
3838

3939
// Bulk request MUST end with line return
4040
$request = trim($request) . "\n";
41-
4241
$response = $index->request('POST', '/_bulk', [], $request)->getOriginalResponse()->getBody()->getContents();
4342

4443
return array_map('json_decode', explode("\n", $response));

Classes/Eel/ElasticSearchQueryBuilder.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\ElasticSearchClient;
1919
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Exception;
2020
use Flowpack\ElasticSearch\ContentRepositoryAdaptor\Exception\QueryBuildingException;
21+
use Flowpack\ElasticSearch\Domain\Model\Mapping;
2122
use Neos\Flow\Log\ThrowableStorageInterface;
2223
use Neos\Flow\Log\Utility\LogEnvironment;
2324
use Neos\Flow\Persistence\Exception\IllegalObjectTypeException;
@@ -725,7 +726,7 @@ public function moreLikeThis(array $like, array $fields = [], array $options = [
725726
$respondedDocument = current($respondedDocuments);
726727
return [
727728
'_id' => $respondedDocument['_id'],
728-
'_type' => $respondedDocument['_type'],
729+
Mapping::NEOS_TYPE_FIELD => $respondedDocument[Mapping::NEOS_TYPE_FIELD],
729730
'_index' => $respondedDocument['_index'],
730731
];
731732
};

0 commit comments

Comments
 (0)