在Azure搜索上载文档后,我可以查询它吗? [英] Right after uploading a document on Azure Search, can I query it?

查看:51
本文介绍了在Azure搜索上载文档后,我可以查询它吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1)假设我使用Azure搜索API上传新文档:

1) Suppose I use the Azure Search API to upload a new document:

POST /indexes/[index name]/docs/index?api-version=[api-version]  

2)我收到HTTP代码201的响应(文档已成功创建)

2) I get a response with an HTTP code 201 (document was successfully created)

3)我再次使用API​​搜索新上传的文档

3) I use the API again to search the newly uploaded document

我可以100%确定我会在结果中得到文档吗?还是在索引编制过程中会有延迟?

Can I be 100% sure that I will get the document in the results? Or could there be a delay in the indexing process?

推荐答案

否,不能保证文档将在查询中返回.通常的延迟约为几秒钟,但是根据整个系统的负载,它可能需要更长的时间.您需要在服务上运行测试以找到应用程序中的典型延迟.

No, it's not guaranteed the document will be returned in the query. The usual delay is on the order of seconds, but depending on the overall system load it can take longer. You'll need to run tests on your service to find the typical delay in your application.

Azure Search提供最终一致性,即索引在将来的某个时间将保持一致,但不能保证确切的时间.

Azure Search offers eventual consistency which means the index will be consistent at some time in the future but exactly when is not guaranteed.

即使对文档进行轮询,直到它出现在查询结果中,这也不足以始终保证具有多个副本的索引的一致性,因为可以将请求与合并到索引副本中的文档进行交错.例如

Even polling for the document until it shows up in a query result is not sufficient to always guarantee consistency for indexes with multiple replicas, because requests can be interleaved with documents merging into replicas of the index. For example

  1. 复制品A和B一致
  2. 客户上传新文档
  3. 副本A收到上传请求
  4. 副本A处理上传请求,并准备好在查询结果中返回新文档
  5. 客户查询恰好由副本A提供服务的新文档,并在结果中获取新文档
  6. 客户端再次查询新文档,这次恰好由副本B提供服务,并且没有从结果中获取新文档
  7. 新文档由副本B处理
  8. 两个副本现在再次保持一致

这篇关于在Azure搜索上载文档后,我可以查询它吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆