-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Index already exists exception #132
Comments
I do not know what is wrong, but perhaps try Elasticsearch 1.x, since more things in the code do not work yet with Elasticsearch 2.x (e.g. #130). @nickstenning or @tilgovi (or whoever with access), could you update the readme to reflect this? |
I tested it with ElasticSearch 1.7.4 on a Xubuntu installation and everything seems to be fine. |
I dived into the source code and found the error source in elasticsearch.py at line 97
Are you checking the type of error by comparing strings? Seriously? So in my case this leads to an exception. Please fix this |
At the time this code was written there was no exception hierarchy in the python ElasticSearch client. There was no way to determine the type of the error except by inspecting the string value of the error. More importantly, you are currently commenting on an issue for a piece of open source software. It was developed by a variety of people, some of whom contributed to it in their free time. You have paid no money to use it. You are under no obligation to use it. Please adjust your tone. |
Okay I understand. I checked the source code of pyelasticsearch and they do it the same way like you. Actually I would prefer an exception-preventing approach: check if the index already exist before creating it. You can see my suggestion here FUB-HCC@21bb8de If you go with my solution I can create a Pull Request. |
Checking that the index doesn't exist first will not be bulletproof because the index might be created between the check and the call to create. I would prefer that we remove the exception handling entirely and leave it to the operator to invoke a script to create the index interactively. Making the creation implicit increases the likelihood that the index already exists and that multiple instances race to create an index. It's also better to be paranoid, I think, that perhaps you're writing to the wrong index if you're trying to create it and it already exists. |
The change then, that I propose, is to move the exception code out of It might be reasonable to then perform the check that you have for existence in the run script, since it serves as an example CLI, @abreitenfeld. I generally I believe it's better to let the errors bubble and catch them at the interface, where we know more about the user intent. A CLI script is a better place to catch than in the guts of the model code. |
That sounds good to me. One information aside, I tested it with ElasticSearch 2.x. and immediately got some exceptions. Maybe you restrict the supported versions to 1.x in the meantime |
I'm re-opening this because we can solve it with a simple |
Get this exception when I try to start the latest (0.14.2) Annotator Store on a clean and empty installation of ElasticSearch 2.1.1
The text was updated successfully, but these errors were encountered: