Skip to content

Changed examples deleting Elasticsearch indices - #2635

Merged
mnocon merged 7 commits into
5.0from
elasticsearch-warning
Feb 4, 2026
Merged

mnocon merged 7 commits into
5.0from
elasticsearch-warning

Conversation

@mnocon

@mnocon mnocon commented Feb 25, 2025 •

Copy link
Copy Markdown
Contributor

Target: master, 4.6, 3.3

Community feedback:

Hi, can you please update https://doc.ibexa.co/en/latest/update_and_migration/from_4.5/update_from_4.5/#updateelasticsearch-schema 
to indicate that the DELETE curl with 'all' is highly destructive and should not be run on elastic.co hosted servers.
instead the curl should target the specific CMS indexes like 'default*'

I've verified locally that it works by running the Elasticsearch container and then executing:

php bin/console ibexa:reindex
curl --request DELETE 'http://0.0.0.0:9200/default_content*'
curl --request DELETE 'http://0.0.0.0:9200/default_location*'
php bin/console ibexa:elasticsearch:put-index-template
php bin/console ibexa:reindex

which is enough to solve the issue described in https://issues.ibexa.co/browse/IBX-3758, but potentially less desctuctive.

@github-actions

Copy link
Copy Markdown

@mnocon
mnocon marked this pull request as ready for review February 25, 2025 14:11
@mnocon
mnocon requested review from a team and vidarl February 25, 2025 14:11

To delete the index, you can use an HTTP request.
To delete the index, use the [delete index REST API](https://www.elastic.co/guide/en/elasticsearch/reference/7.17/indices-delete-index.html).
Use the command as in the following example:

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.

Suggested change
Use the command as in the following example:
Use the commands as in the following example:

@vidarl vidarl left a comment

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.

Hmm.. I am not sure how destructive it is when running on elastic.co servers ( if it deletes metadata needed by the service too ?), but if we don't delete everything, we must document better what we delete. These default_ values comes from the template, https://doc.ibexa.co/en/latest/search/search_engines/elasticsearch/configure_elasticsearch/#define-a-template

So with out-of-the-box config, the new documentation is correct. But with changed templates, the commands needs to be adjusted accordingly

@mnocon
mnocon changed the base branch from master to 5.0 May 19, 2025 07:26
@github-actions

Copy link
Copy Markdown

@mnocon
mnocon force-pushed the elasticsearch-warning branch from 745700c to b4003b5 Compare January 20, 2026 09:15
@mnocon
mnocon requested a review from vidarl January 20, 2026 13:05

@vidarl vidarl left a comment

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.

Looks fine to me ( I haven't tested this though)
Feel free to implement my two suggestion or choose to ignore them

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

``` 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

First, use the [`_cat/indices` endpoint](https://www.elastic.co/guide/en/elasticsearch/reference/8.19/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

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?

@mnocon
mnocon force-pushed the elasticsearch-warning branch from 5a05eee to 4249e73 Compare January 20, 2026 13:52
@mnocon

mnocon commented Jan 20, 2026

Copy link
Copy Markdown
Contributor Author

Thank you Vidar, added the suggestions in 4249e73

@mnocon

mnocon commented Jan 20, 2026

Copy link
Copy Markdown
Contributor Author

@ibexa/documentation I've added some changes, you might want to have another look since your last review

Comment thread docs/snippets/elasticsearch_clear_index.md Outdated
@mnocon
mnocon merged commit 73ba39e into 5.0 Feb 4, 2026
9 checks passed
@mnocon
mnocon deleted the elasticsearch-warning branch February 4, 2026 08:29
mnocon added a commit that referenced this pull request Feb 4, 2026
* Changed examples deleting Elasticsearch indices

* Added mention about custom indices. Extrcted to snippet

* Adjusted to ES 8.19

* Made path absolute

* Fixed typo

* Review feedback

* Update docs/snippets/elasticsearch_clear_index.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants