indexElasticSearch example

static::markTestSkipped('No OPENSEARCH configured');
        }

        $this->connection->executeStatement('DELETE FROM promotion');

        $id = 'c1a28776116d4431a2208eb2960ec340';
        $this->createPromotion([
            'id' => $id,
            'name' => 'elasticsearch',
        ]);

        $this->indexElasticSearch(['--only' => ['promotion']]);

        $request = new Request();
        $request->request->set('term', 'elasticsearch');
        $request->request->set('entities', ['promotion']);
        $response = $this->controller->elastic($request, Context::createDefaultContext());

        static::assertEquals(200, $response->getStatusCode());

        $content = $response->getContent();
        static::assertNotFalse($content);

        
$connection->rollBack();
    }

    public function testIndexing(): IdsCollection
    {
        static::expectNotToPerformAssertions();

        $this->connection->executeStatement('DELETE FROM product');

        $this->clearElasticsearch();
        $this->registerCustomFieldsMapping();
        $this->indexElasticSearch();

        $ids = new TestDataCollection();
        $this->createData($ids);

        $this->refreshIndex();

        return $ids;
    }

    /** * @depends testIndexing */
'itemRounding' => json_decode(json_encode(new CashRoundingConfig(2, 0.05, true), \JSON_THROW_ON_ERROR), true, 512, \JSON_THROW_ON_ERROR),
                    'totalRounding' => json_decode(json_encode(new CashRoundingConfig(2, 0.05, true), \JSON_THROW_ON_ERROR), true, 512, \JSON_THROW_ON_ERROR),
                ],
            ];

            $this->getContainer()
                ->get('currency.repository')
                ->upsert($currencies$this->context);

            $this->createData();

            $this->indexElasticSearch();

            $criteria = new Criteria();
            $criteria->addFilter(
                new NandFilter([new EqualsFilter('salesChannelDomains.id', null)])
            );

            if (Feature::isActive('ES_MULTILINGUAL_INDEX')) {
                $index = $this->helper->getIndexName($this->productDefinition);

                $exists = $this->client->indices()->exists(['index' => $index]);
                static::assertTrue($exists, 'Expected elasticsearch indices present');
            }
Home | Imprint | This part of the site doesn't use cookies.