Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
[[% include 'snippets/elasticsearch_clear_index.md' %]]
36 changes: 36 additions & 0 deletions docs/snippets/elasticsearch_clear_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
To delete an index, you can use the Elasticsearch's REST API.

Check warning on line 1 in docs/snippets/elasticsearch_clear_index.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/snippets/elasticsearch_clear_index.md#L1

[Ibexa.ReadingLevel] The grade level is 7.10. Aim for 8th grade or lower by using shorter sentences and words.
Raw output
{"message": "[Ibexa.ReadingLevel] The grade level is 7.10. Aim for 8th grade or lower by using shorter sentences and words.", "location": {"path": "docs/snippets/elasticsearch_clear_index.md", "range": {"start": {"line": 1, "column": 1}}}, "severity": "WARNING"}

First, use the [`_cat/indices` endpoint](https://www.elastic.co/guide/en/elasticsearch/reference/8.19/cat-indices.html) to list existing indices.
For example, the command `curl -H "Accept: application/text" elasticsearch:9200/_cat/indices` returns output like the following:

``` bash
yellow open default_location_eng_gb_54 DoSFV-CtQFylKKVvd48YfA 1 1 1 0 16.7kb 16.7kb

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly show the exact curl commands for getting this?

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-mapping-templates) as well.

Then, delete them by using the [delete index endpoint](https://www.elastic.co/guide/en/elasticsearch/reference/8.19/indices-delete-index.html)

Check warning on line 18 in docs/snippets/elasticsearch_clear_index.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/snippets/elasticsearch_clear_index.md#L18

[Ibexa.EOLWhitespace] Remove whitespace characters from the end of the line.
Raw output
{"message": "[Ibexa.EOLWhitespace] Remove whitespace characters from the end of the line.", "location": {"path": "docs/snippets/elasticsearch_clear_index.md", "range": {"start": {"line": 18, "column": 143}}}, "severity": "WARNING"}

``` bash
curl --request DELETE 'https://elasticsearch:9200/default_location*'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As described in the PR description:

DELETE curl with 'all' is highly destructive and should not be run on elastic.co hosted servers.

Just a suggestion:
So, maybe write that... That if you are hosting ES yourself, and only use if for Ibexa DXP caching, you maybe just do a quick curl --request DELETE 'https://elasticsearch:9200/_all'. But if are using elastic.co hosted services or possibly have other data stored in your ES, then take the long way and check what to explicit delete

curl --request DELETE 'https://elasticsearch:9200/default_content*'
(...)
```

!!! tip

To quickly delete all existing Elasticsearch indices, you can use the `_all` keyword as the name of the index, as in the following request: `curl --request DELETE https://elasticsearch:9200/_all`.
Always review the list of existing indices and confirm they are safe to delete before executing this command, as it permanently removes data.

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
```
14 changes: 1 addition & 13 deletions docs/update_and_migration/from_4.5/update_from_4.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -489,19 +489,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

Expand Down