如何冲洗数据到弹簧数据弹性搜索
我运行此测试箱
Envelope envelope = new Envelope();
envelope.setId("1");
Envelope saved = envelopeRepository.save(envelope);
assertThat(saved.getId()).isEqualTo("1");
保存,并且信封是同一对象/参考!因此,即使索引不正确,测试仍然通过!如何解决此问题?
org.elasticsearch.client.RestClient - request [HEAD http://localhost:9200/null?ignore_throttled=false&ignore_unavailable=false&expand_wildcards=open%2Cclosed&allow_no_indices=false]
I run this testcase
Envelope envelope = new Envelope();
envelope.setId("1");
Envelope saved = envelopeRepository.save(envelope);
assertThat(saved.getId()).isEqualTo("1");
saved and envelope are the same object/reference! So even when the index is incorrect, the test still passes! How to fix this issue?
org.elasticsearch.client.RestClient - request [HEAD http://localhost:9200/null?ignore_throttled=false&ignore_unavailable=false&expand_wildcards=open%2Cclosed&allow_no_indices=false]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么保存的实体应该是一个新对象?保存时,Elasticsearch不会返回文档,因此无需在此处创建一个新对象。
Spring Data Elasticsearch的操作是用索引操作返回的信息更新此对象:
id
如果该对象尚未在对象上设置,但primary_term
如果实体具有此类属性,如果索引失败,则会引发异常。
你是什么意思
, head 请求对此有何处理?
Why should the saved entity be a new object? Elasticsearch does not return a document when saving, so there is no need to create a new object here.
What Spring Data Elasticsearch does is update this object with the information returned from the index operation:
id
if it was not already set on the object but was created by Elasticsearchseq_no
andprimary_term
if the entity has such a propertyIf the indexing fails, an exception is thrown.
What do you mean with
And what has the HEAD request do do with this?