CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C Elastic Search 4.x API

  • Project:
    • Elastic Search
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 4.x
      • 4.x
      • 3.x
      • 2.x

Namespaces

  • Cake\ElasticSearch
    • Association
    • Datasource
    • Exception
    • Rule
    • TestSuite
      • Fixture
    • View

Class MappingGenerator

Create indexes and mappings for test cases.

Index definition files should return an array of indexes to create. Each index in the array should follow the form of

[
  'name' => 'articles',
  'mapping' => [...],
  'settings' => [...],
]

The mapping key should be compatible with Elasticsearch's mapping API and Elastica.

The settings key can contain Elastica compatible index creation settings.

Namespace: Cake\ElasticSearch\TestSuite\Fixture
See: https://elastica.io/getting-started/storing-and-indexing-documents.html#define-mapping

Property Summary

  • $connection protected
    string
  • $file protected
    string

Method Summary

  • __construct() public

    Constructor

  • createIndex() protected

    Create an index.

  • dropIndex() protected

    Drop an index if it exists.

  • reload() public

    Drop and re-create indexes defined in the mapping schema file.

Method Detail

__construct() ¶ public

__construct(string $file, string $connection)

Constructor

Parameters
string $file

The index definition file.

string $connection

The connection to put indexes into.

createIndex() ¶ protected

createIndex(Cake\ElasticSearch\Datasource\Connection $db, array $mapping): void

Create an index.

Parameters
Cake\ElasticSearch\Datasource\Connection $db

The connection.

array $mapping

The index mapping and settings.

Returns
void

dropIndex() ¶ protected

dropIndex(Cake\ElasticSearch\Datasource\Connection $db, string $name): void

Drop an index if it exists.

Parameters
Cake\ElasticSearch\Datasource\Connection $db

The connection.

string $name

The name of the index to drop.

Returns
void

reload() ¶ public

reload(array<string> $indexes = null): void

Drop and re-create indexes defined in the mapping schema file.

Parameters
array<string> $indexes optional

A subset of indexes to reload. Used for testing.

Returns
void

Property Detail

$connection ¶ protected

Type
string

$file ¶ protected

Type
string
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs