Infrequent Elasticsearch index issue when restarting hypothesis/h

23 views
Skip to first unread message

Chris Taylor

unread,
Feb 7, 2023, 6:38:38 PM2/7/23
to Hypothes.is Forum
Hello everyone,

As part of a personal project, I have Hypothesis running with both h and client on the same EC2 instance. At first they worked flawlessly, but I noticed that h's web app (the one that defaults to port 5000) would hang after a few days of being active. 

Every so often after restarting the instance to bring it back from that state, annotations were no longer saving properly. Upon further inspection I found that the saves weren't taking due to an Elasticsearch error:

Alias [hypothesis] has more than one indices associated with it [...]. can't execute a single index op.

I imagine that's probably the tip of an iceberg, but I am curious to know if any of you have run into similar problems or if it's just me. 

Either way, I will likely just use the public Hypothesis instance so that I don't need to worry about these sorts of problems in the future.

Best,
Chris Taylor


mdiro...@hypothes.is

unread,
Feb 8, 2023, 9:11:30 AM2/8/23
to Hypothes.is Forum
Hi Chris,

I'm on the Support team. One of our developers pointed me at some internal info that I hope helps. Here's what we have internally when seeing this issue.

***

You need to get it so there is only one active Elasticsearch index. Talking to ES via its API is actually refreshingly straightforward. By CURLing a command at the local ES port (9200 as of this writing), you can tell it to delete any indexes you don't want anymore, for example:

curl -X POST "localhost:9200/_aliases" -H 'Content-Type: application/json' -d' { "actions" : [ { "remove_index": { "index": "hypothesis-xxxxxxxx" } } ] } '

Lest forming that CURL seem onerous, take a visit to ES' very helpful docs page on the API, which includes the ability to copy pre-formatted CURL commands to your clipboard! Handy.

***

Best,
Michael
Reply all
Reply to author
Forward
0 new messages