I will not maintain this bundle anymore, prefer elastica-extra-bundle.
Extra tools for managing indices and types. Built on top of m6web/elasticsearch-bundle.
With composer :
composer require gbprod/elasticsearch-extra-bundle
Update your app/AppKernel.php
file:
public function registerBundles()
{
$bundles = array(
new M6Web\Bundle\ElasticsearchBundle\M6WebElasticsearchBundle(),
new GBProd\ElasticsearchExtraBundle\ElasticsearchExtraBundle(),
);
}
See M6WebElasticsearchBundle for configuring clients.
Set indices setup
elasticsearch_extra:
indices:
my_index:
settings:
number_of_shards: 3
number_of_replicas: 2
mappings:
my_type:
_source:
enabled: true
properties:
first_name:
type: string
analyzer: standard
age:
type: integer
my_index_2: ~
See Official documentation for options.
With default client:
php app/console elasticsearch:index:create my_index
Or with specified client:
php app/console elasticsearch:index:create my_index --client=my_client
With default client:
php app/console elasticsearch:index:delete my_index --force
Or with specified client:
php app/console elasticsearch:index:delete my_index --force --client=my_client
With default client:
php app/console elasticsearch:index:put_settings my_index
Or with specified client:
php app/console elasticsearch:index:put_settings my_index --client=my_client
With default client:
php app/console elasticsearch:index:put_mappings my_index my_type
Or with specified client:
php app/console elasticsearch:index:put_mappings my_index my_type --client=my_client