行动是治愈恐惧的良药,而犹豫、拖延将不断滋养恐惧。

ES5.5 的refresh api java怎么设置

Elasticsearch | 作者 elastic_kevin123 | 发布于2017年07月25日 | 阅读数:5586

setRefresh(boolean) has been removed in favor of setRefreshPolicy(RefreshPolicy) because there are now three options (NONE, IMMEDIATE, and WAIT_FOR). setRefresh(IMMEDIATE) has the same behavior as setRefresh(true) used to have. See setRefreshPolicy's javadoc for more.
已邀请:

elastic_kevin123

赞同来自:

比如加入存储一条数据后,我马上要返回数据的总条数,这个时候,会出问题,Elasticsearch会返回操作之前的数据,也就是假如开始有500条数据,我Insert了一条进去,按道理来说应该是501条,但是这个时候查询会发现,只有500条数据,再次请求又得到501条数据,这个是怎么回事呢?

这个问题因为 Elasticsearch  有延迟的关系(好像记得是3秒还是1秒来着)。有的人的做法比如有以下方法解决的。

要回复问题请先登录注册