4.1 Index - Osushi/ElasticsearchOrm GitHub Wiki
Index
Creating a new index
[model]
$model->createIndex();
[client]
$client->index('index')->createIndex();
Creating index with custom options (optional)
[model]
$model->createIndex(function($index){
$index->shards(5)->replicas(1)->mappings([
'my_type' => [
'properties' => [
'my_field' => [
'type' => 'string',
],
]
]
]);
});
[client]
$client->index('index')->createIndex(function($index){
$index->shards(5)->replicas(1)->mappings([
'my_type' => [
'properties' => [
'my_field' => [
'type' => 'string',
],
]
]
]);
});
Dropping index
[model]
$model->dropIndex();
[client]
$client->index('index')->dropIndex();
Check index
[model]
$model->existsIndex();
[client]
$client->index('index')->existsIndex();
Refresh index
[model]
$model->refreshIndex();
[client]
$client->index('index')->refreshIndex();