PHP code example of ebrana / elasticsearch-bundle

1. Go to this page and download the library: Download ebrana/elasticsearch-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ebrana / elasticsearch-bundle example snippets


#[NestedType(
   keyResolver: CustomKeyResolver::class,
   fieldsTemplate: new TextType(),
)]
protected array $sellingPrice = [];



declare(strict_types=1);

namespace Elasticsearch\Tests;

use Elasticsearch\Mapping\Drivers\Events\PostEventInterface;
use Elasticsearch\Mapping\Index;
use Elasticsearch\Mapping\Types\Text\TextType;

class PostEventSample implements PostEventInterface
{
    public function postCreateIndex(Index $index): void
    {
        $field = new TextType(name: 'postEventName');
        $field->setFieldName('postEventName');
        $index->addProperty($field);
    }
}