Deleting an index is performed in 2 steps: 1. Index is cleared
(similar to TRUNCATE) 2. All index
files are removed from the index folder. All the external index files
that were used by the index (such as wordforms, extensions or stopwords)
are also deleted. Note that these external files are copied to index
folder when CREATE TABLE is used, so the original files
specified in CREATE TABLE will not be deleted.
Deleting an index is possible only when the server is running in RT mode. It is possible to delete RT indexes, PQ indexes and distributed indexes.
DROP TABLE products;Query OK, 0 rows affected (0.02 sec)POST /cli -d "DROP TABLE products"
{
"total":0,
"error":"",
"warning":""
}
$params = [ 'index' => 'products' ];
$response = $client->indices()->drop($params);Array
(
[total] => 0
[error] =>
[warning] =>
)utilsApi.sql('mode=raw&query=DROP TABLE products'){u'error': u'', u'total': 0, u'warning': u''}res = await utilsApi.sql('mode=raw&query=DROP TABLE products');{"total":0,"error":"","warning":""}sqlresult = utilsApi.sql("mode=raw&query=DROP TABLE products");{total=0, error=, warning=}Here is the syntax of the DROP TABLE statement in
SQL:
DROP TABLE [IF EXISTS] index_nameWhen deleting an index via SQL, adding IF EXISTS can be
used to delete the index only if it exists. If you try to delete a
non-existing index with the IF EXISTS option, nothing
happens.
When deleting an index via PHP, you can add an optional
silent parameter which works the same as IF
EXISTS.
DROP TABLE IF EXISTS products;POST /cli -d "DROP TABLE IF EXISTS products"
$params =
[
'index' => 'products',
'body' => ['silent' => true]
];
$client->indices()->drop($params);utilsApi.sql('mode=raw&query=DROP TABLE IF EXISTS products'){u'error': u'', u'total': 0, u'warning': u''}res = await utilsApi.sql('mode=raw&query=DROP TABLE IF EXISTS products');{"total":0,"error":"","warning":""}sqlresult = utilsApi.sql("mode=raw&query=DROP TABLE IF EXISTS products");{total=0, error=, warning=}