[英]How to specify version type in elasticsearch
I'm trying to index a document as shown below. 我正在尝试为文档编制索引,如下所示。
curl -s -XPUT -H"content-type:application/json" -d@data.json localhost:9200/contacts/_doc/1?version=7&version_type=external
Unfortunately this results in version conflict. 不幸的是,这导致版本冲突。 Elasticsearch documentation says that I should pass
version_type
as external
when I use an external version. Elasticsearch文档说,当我使用外部版本时,我应该将
version_type
作为external
传递。 But I'm not sure how to do this as its not supporting this as a query parameter. 但是我不确定如何执行此操作,因为它不支持将此作为查询参数。
How do I specify version_type
as external? 如何将
version_type
指定为外部?
EDIT: current version of the document is 5. But according to es documentation , when version_type external
is used, any higher version should work. 编辑:该文档的当前版本为5。但是根据es文档 ,当使用version_type
external
时,任何更高的版本都应该起作用。 Which means 7 should be able to overwrite 5. But as I'm getting version conflict I assume that es is not taking the version_type
parameter that I'm specifying. 这意味着7应该可以覆盖5。但是当我遇到版本冲突时,我假设es没有采用我指定的
version_type
参数。
SOLVED: I had to put the URL given to curl in quotes. 已解决:我必须将给定的URL放在引号中。 Bash took the
&
in in URL, took rest of it as new command and set version_type
as an environment variable. Bash将URL中的
&
引入,将其其余部分用作新命令,并将version_type
设置为环境变量。
Your curl command looks correct. 您的curl命令看起来正确。 The conflict can come because of the different versions of the document.
冲突可能是由于文档版本不同而引起的。
I would guess that the current version of the document is not 7 and hence it throws the version conflict. 我猜该文档的当前版本不是7,因此会引发版本冲突。
Can you post the current version of this same document? 您可以发布同一文档的当前版本吗? Is it 7 ?
是7吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.