Elasticsearch automatically refreshes each index periodically, by default every 1 second (it's customizable per index). So there is the time-boxed approach out of the box (we need to decide whether to make it configurable through HSEARCH, but that's more nice-to-have than strictly needed as the user can set it directly in ES themselves). Independently from that, there is an explicit REFRESH command, which we currently issue with each bulk of operations. The main (only?) reason being our test suite, in practice I expect most users to be perfectly fine with visibility within one second. Controlling the explicit refresh through an option (defaulting to not doing it), would accomodate for the needs of the test suite. It's the best way forward I can see right now (if we want to re-use the tests from the orm module; Otherwise we could have an explicit refresh API and invoke it at suitable points within tests), although that option hardly ever would be used by users. |