public function createIndex(): bool
    {
        $class = $this->class;

        $indexParams = [
            'index' => $this->index,
        ];

        if (count($this->notAnalyzedFields)) {
            $indexParams['body'] = [
                'mappings' => [
                    $class => [
                        '_source'    => [
                            'enabled' => true
                        ],
                        'properties' => $this->createNotAnalyzedFieldsMapping($this->notAnalyzedFields),
                    ]
                ]
            ];
        }

        $this->client->indices()->create($indexParams);
        $response = $this->client->cluster()->health([
            'index'           => $this->index,
            'wait_for_status' => 'yellow',
            'timeout'         => '5s',
        ]);

        return isset($response['status']) && $response['status'] !== 'red';
    }
public function createIndex(): bool
    {
        $class = $this->class;

        $indexParams = [
            'index' => $this->index,
        ];

        if (count($this->notAnalyzedFields)) {
            $indexParams['body'] = [
                'mappings' => [
                    $class => [
                        '_source'    => [
                            'enabled' => true
                        ],
                        'properties' => $this->createNotAnalyzedFieldsMapping($this->notAnalyzedFields),
                    ]
                ]
            ];
        }

        $this->client->indices()->create($indexParams);
        $response = $this->client->cluster()->health([
            'index'           => $this->index,
            'wait_for_status' => 'yellow',
            'timeout'         => '5s',
        ]);

        return isset($response['status']) && $response['status'] !== 'red';
    }
public function createIndex ( ) : bool { $ class = $ this -> class ; $ indexParams = [ 'index' => $ this -> index , ] ; if ( count ( $ this -> notAnalyzedFields ) ) { $ indexParams [ 'body' ] = [ 'mappings' => [ $ class => [ '_source' => [ 'enabled' => true ] , 'properties' => $ this -> createNotAnalyzedFieldsMapping ( $ this -> notAnalyzedFields ) , ] ] ] ; } $ this -> client -> indices ( ) -> create ( $ indexParams ) ; $ response = $ this -> client -> cluster ( ) -> health ( [ 'index' => $ this -> index , 'wait_for_status' => 'yellow' , 'timeout' => '5s' , ] ) ; return isset ( $ response [ 'status' ] ) && $ response [ 'status' ] !== 'red' ; }
Creates the index for this repository's ReadModel.

@return boolean True, if the index was successfully created
Creates the index for this repository s ReadModel .