gpt4 book ai didi

elasticsearch - 将快照添加到Elasticsearch Windows

转载 作者:行者123 更新时间:2023-12-03 02:37:50 25 4
gpt4 key购买 nike

我有两个要插入path中的elasticsearch的快照:

C:\Users\name\Downloads\book_backup\agg_example
C:\Users\name\Downloads\book_backup\search_example

我正确地在elasticsearch.yml中列出了
path.repo: ["C:\\Users\\olulo\\Downloads\\book_backup\\agg_example", "C:\\Users\\olulo\\Downloads\\book_backup\\search_example"]

我的Elasticsearch可以正常运行,并且创建新索引也可以。

现在,当我尝试将快照插入我的elasticsearch中时,我可以对其进行处理:
curl -XPUT "http://localhost:9200/movies/" -d '{"type":"fs", "settings":{"location":"C:\\Users\\name\\Downloads\\book_backup\\search_example", "compress":true}}'

它给了我:
curl: (1) Protocol "'http" not supported or disabled in libcurl
curl: (3) [globbing] unmatched brace in column 10
curl: (3) [globbing] unmatched close brace/bracket in column 14

https://www.elastic.co/guide/en/elasticsearch/reference/5.2/modules-snapshots.html中,好像他们在路径的末尾添加了一个名称,所以我做了
curl -XPUT "http://localhost:9200/movies/" -d '{"type":"fs", "settings":{"location":"C:\\Users\\name\\Downloads\\book_backup\\search_example\\test", "compress":true}}'

但仍然给我同样的错误。

https://superuser.com/questions/1322567/http-not-supported-or-disabled-in-libcurl之后,我将所有内容都更改为双引号:
 curl -XPUT "http://localhost:9200/_snapshot/javacafe" -d "{"type":"fs", "settings":{"location":"C:\\Users\\olulo\\Downloads\\book_backup\\search_example", "compress":true}}"

给我 :
{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}

尝试根据建议的 Content-Type header [application/x-www-form-urlencoded] is not supported on Elasticsearch添加curl选项
    curl -XPUT "localhost:9200/_snapshot/javacafe" -H 'Content-Type: application/json' -d "{
"type":"fs",
"settings"{"location":"C:\\Users\\olulo\\Downloads\\book_backup\\search_example\\test", "compress":true}
}"

输出类似的错误,并在末尾添加语句:
{"error":"Content-Type header [application/x-www-form-urlencoded] is not supported","status":406}curl: (6) Could not resolve host: application

已解决:对于Windows,您需要在{}中使用双引号的反斜杠前面的:
    curl -XPUT "localhost:9200/_snapshot/javacafe" -H "Content-Type: application/json" -d "{
\"type\":\"fs\",
\"settings\"{\"location\":"C:\\Users\\olulo\\Downloads\\book_backup\\search_example\\test", \"compress\":true}
}"

根据我的理解,windows使用\照原样考虑“”。如果是这样,为什么不还对所有curl命令添加反斜杠呢?

最佳答案

试试这个:

curl -XPUT "localhost:9200/_snapshot/javacafe" -H 'Content-Type: application/json' -d '{
"type":"fs",
"settings" : {
"location":"C:\\Users\\olulo\\Downloads\\book_backup\\search_example\\test",
"compress":true
}
}'

关于elasticsearch - 将快照添加到Elasticsearch Windows,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58514088/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com