3

I am starting elasticsearch, and getting the error:

java.lang.IllegalStateException: unable to upgrade the mappings for the index [[documents/xOOEXQB-RzGhQp7o7NNH9w]]
    at org.elasticsearch.cluster.metadata.MetaDataIndexUpgradeService.checkMappingsCompatibility(MetaDataIndexUpgradeService.java:172) ~[elasticsearch-5.5.0.jar:5.5.0]

I am not exactly sure what caused this to happen. I did do a brew upgrade elasticsearch but I didn't note down the last version. I am currently on elasticsearch 5.5.

I would like to just clear away all the mappings/indices for elasticsearch. I don't need these data as it is for testing. Most of the documentation says to use

curl -XDELETE 'http://localhost:9200/_all'

However, localhost:9200 isn't reachable (it was previously), presumably because elasticsearch cannot be properly started so it is a bit of chicken and egg.

Is there a way for me to clear away all elasticsearch data manually?

frank
  • 1,283
  • 1
  • 19
  • 39

1 Answers1

1

You probably have some remaining indices that are incompatible with your newest ES version, most certainly you were on ES 1.x before.

You can simply delete anything under the $ES_HOME/data/* folder. Since you installed ES via brew, ES_HOME is usually located at /usr/local/Cellar/elasticsearch

Val
  • 207,596
  • 13
  • 358
  • 360
  • Thanks, I installed elasticsearch on my Mac via homebrew, then did a homebrew upgrade. The ES_HOME variable is undefined. But I do have a couple of directories under /usr/local/Cellar/elasticsearch. There is a 5.3.1 folder, and a 5.5.0 folder. However, neither of them have the data folder. The index it is complaining about seems to be from my experimentation with document search with the mapper attachment plugin on 5.3.1. – frank Jul 20 '17 at 16:44
  • I went and look up the documentation for elasticsearch directories at https://www.elastic.co/guide/en/elasticsearch/reference/2.0/setup-dir-layout.html. However, the directory isn't quite the same as the default that I have on my machine with the hombrew install. I found the offending indices files under, /usr/local/var/elasticsearch/nodes/0/indices () $. If I remove the offending indices (that were created using the mapper attachment plugin), then I can start elasticsearch 5.5.0. But I have decided to brew switch to 5.3.1 installed on my machine to match Amazon elasticsearch. – frank Jul 20 '17 at 21:15
  • thank you for pointing me in the right direction. After working out this issue, I posted a follow up question on whether I can lock down on an elasticsearch version with homebrew, https://stackoverflow.com/questions/45225432/how-can-i-install-elasticsearch-5-3-1-with-homebrew. Please let me know if you know anything. – frank Jul 20 '17 at 21:24
  • 1
    On later versions the data dir is defined in the elasticsearch config, which by default from a homebrew install is located at `/usr/local/etc/elasticsearch/elasticsearch.yml`. In the yml file is a `path.data` setting which lists a directory under which all data is stored. By default this is `/usr/local/var/lib/elasticsearch/`. – Puhlze Feb 12 '21 at 21:20