I am working with Elasticsearch(ES) 5 and NEST 5 on C#
I have a workflow implemented using ES. Simplifiying the workflow has 2 steps.
Step 1: I generate the recipients for a message using an UpdateByQuery statement base on some criteria.
Step 2: I query all recipients generated on step 1 to actualy deliver the message.
The problem I am facing is that some times the first step run so fast that when the second step runs the index is not refresh yet, so no recipient is found.
I tried setting "WaitForCompletion(true)" (default on Nest) but I get the same result. Also I notice that UpdateByQuery does not support refresh=wait_for so not sure how to do this.
My update by query looks like this:
query
.Index(allIndexesStr)
// Exclude all contact in this list
.Query(q =>
...
)
.WaitForCompletion(true)
// Update script
.Script(script => script
.Inline(scriptStr)
.Params(p =>
...
)
)
.Routing(customerSiteId.ToString());
My search look like this:
search
.Index(allIndexesStr)
.Size(size)
.Scroll(timeout)
.Query(q =>
...
)
.Sort(sort => sort
.Ascending("contactGuid.keyword")
)
.Routing(customerSiteId.ToString());
So I am wondering how is the propper way to solve this issue using ES...
Any help will be appreciate