diff --git a/docs/search/search_engines/elasticsearch/elasticsearch_overview.md b/docs/search/search_engines/elasticsearch/elasticsearch_overview.md index f1222b9924..411cb535d8 100644 --- a/docs/search/search_engines/elasticsearch/elasticsearch_overview.md +++ b/docs/search/search_engines/elasticsearch/elasticsearch_overview.md @@ -24,16 +24,4 @@ To proceed you need to be familiar with how indexing, filtering and queries work Whenever you make any changes in case of variables (for example, environmental ones) or configuration files, you need to erase Elasticsearch index, update the schema, and rebuild the index. -To delete the index, you can use an HTTP request. -Use the command as in the following example: - -```bash -curl --request DELETE 'https://elasticsearch:9200/_all' -``` - -To update the schema and then reindex the search, use the following commands: - -```bash -php bin/console ibexa:elasticsearch:put-index-template --overwrite -php bin/console ibexa:reindex -``` \ No newline at end of file +[[% include 'snippets/elasticsearch_clear_index.md' %]] diff --git a/docs/snippets/elasticsearch_clear_index.md b/docs/snippets/elasticsearch_clear_index.md new file mode 100644 index 0000000000..da81b12c34 --- /dev/null +++ b/docs/snippets/elasticsearch_clear_index.md @@ -0,0 +1,30 @@ +To delete an index, you can use the ElasticSearch's REST API. + +First, use the [`_cat/indices` endpoint](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/cat-indices.html) to list existing indices: + +``` bash +yellow open default_location_eng_gb_54 DoSFV-CtQFylKKVvd48YfA 1 1 1 0 16.7kb 16.7kb +yellow open default_location_eng_gb_42 3Z_IrWVHQh2m37jPqQBOcQ 1 1 1 0 20.1kb 20.1kb +yellow open default_content_eng_gb_45 y-t4uNQwR4KRJ-N9i3zUog 1 1 1 0 21.3kb 21.3kb +yellow open default_content_eng_gb_46 e_LS5qG3RIih6iQRPsNp-w 1 1 1 0 22.5kb 22.5kb +yellow open default_content_eng_gb_1 101-1-tQS_2KSvNs2X2JAQ 1 1 17 0 39.8kb 39.8kb +yellow open default_location_eng_gb_46 fSGtpljwTpGfascFechmww 1 1 1 0 21kb 21kb +(...) +``` + +Create a list containing all indices used by the DXP, including the [custom indices](search/search_engines/elasticsearch/configure_elasticsearch.md#define-field-type-mappingtemplates) as well. + +Then, delete them by using the [delete index endpoint](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/indices-delete-index.html) + +``` bash +curl --request DELETE 'https://elasticsearch:9200/default_location*' +curl --request DELETE 'https://elasticsearch:9200/default_content*' +(...) +``` + +To update the schema and then reindex the search, use the following commands: + +``` bash +php bin/console ibexa:elasticsearch:put-index-template --overwrite +php bin/console ibexa:reindex +``` diff --git a/docs/update_and_migration/from_4.5/update_from_4.5.md b/docs/update_and_migration/from_4.5/update_from_4.5.md index b4b096f723..da831e541d 100644 --- a/docs/update_and_migration/from_4.5/update_from_4.5.md +++ b/docs/update_and_migration/from_4.5/update_from_4.5.md @@ -463,19 +463,7 @@ Restart Solr for `solrconfig.xml` changes to take effect. Elasticsearch schema's templates change, for example, with the addition of new features such as spellchecking. When this happens, you need to erase the index, update the schema, and rebuild the index. -To delete the index, you can use an HTTP request. -Use the command as in the following example: - -```bash -curl --request DELETE 'https://elasticsearch:9200/_all' -``` - -To update the schema, and then reindex the content, use the following commands: - -```bash -php bin/console ibexa:elasticsearch:put-index-template --overwrite -php bin/console ibexa:reindex -``` +[[% include 'snippets/elasticsearch_clear_index.md' %]] ## Update to v4.6.latest