ElasticSearch新手-创建第一个索引



有一个客户端认为这将是了不起的用来抓取10MB的日志文件卷。我同意阅读它,但似乎卡在创建我的第一个索引。到目前为止:

♦在Windows 8上安装ElasticSearch 1.2.1, Curl 7.3.7 (HTTP for SSL,这里:paehl.com/open_source/?CURL_7.37.0)
ES的响应成功(状态200,hurrah,在本地主机上,127.0.0.1或我的机器的IP状态为200)
♦当我试图创建一个索引,然而,没有爱。一直试图遵循Joel Abrahamsson的ElasticSearch 101 (joelabrahamsson.com/elasticsearch-101/)和Park的"ES Cookbook"的步骤。错误范围很广,但最近和最短的错误与以下错误相当:

C:>curl -XPUT 'http://localhost:9200/blog/user/dilbert' -d '{ "name" : "Dilbert Brown" }'
curl: (1) Protocol 'http not supported or disabled in libcurl
curl: (6) Could not resolve host: name
curl: (7) Failed to connect to  port 80: Connection refused
curl: (6) Could not resolve host: Dilbert Brown
curl: (3) [globbing] unmatched close brace/bracket in column 1

早期的消息要冗长得多:

C:>curl -XPUT "http://localhost:9200/test1/test/1" -d' { "title" : "Godfather", "director" : "Coppola", "year" : 1972 }'
{"error":"MapperParsingException[failed to parse]; nested: ElasticsearchParseException[Failed to derive xcontent from (offset=0, length=1): [39]]; ","status":400}curl: (3) [globbing] unmatched brace in column 1
curl: (6) Could not resolve host: title
curl: (7) Failed to connect to  port 80: Connection refused
curl: (6) Could not resolve host: Godfather,
curl: (6) Could not resolve host: director
curl: (7) Failed to connect to  port 80: Connection refused
curl: (6) Could not resolve host: Coppola,
curl: (6) Could not resolve host: year
curl: (7) Failed to connect to  port 80: Connection refused
curl: (6) Could not resolve host: 1972
curl: (3) [globbing] unmatched close brace/bracket in column 1

感觉我忽略了一些基本的东西,但作为ES, curl和JSON的新手,我很困惑——至少从我的座位上,大括号/括号看起来很平衡。

建议?

这是Windows的cmd的问题。你可以修改:

curl -XPUT 'http://localhost:9200/blog/user/dilbert' -d '{ "name" : "Dilbert Brown" }'

:

curl -XPUT "http://localhost:9200/blog/user/dilbert" -d "{ """name""" : """Dilbert Brown""" }"

更新:(适用于windows 64位)

curl -XPUT "http://localhost:9200/blog/user/dilbert" -d "{ "name" : "Dilbert Brown" }"

似乎windows不喜欢url周围的单引号。我不能为你测试它,但试着在url周围加上双引号。

我从下面的博客文章中得到了这个信息:http://bartwullems.blogspot.nl/2013/08/curl-1-protocol-not-supported-or.html

用elasticsearch教程中所示的json请求消息创建一个本地文件,转到该目录并执行curl命令,引用该文件:

curl -XPUT http://localhost:9200/shakespeare --data-binary "@_01_specify_schema.json"

_01_specify_schema的地方。Json文件包含:

{
 "mappings" : {
  "_default_" : {
   "properties" : {
    "speaker" : {"type": "string", "index" : "not_analyzed" },
    "play_name" : {"type": "string", "index" : "not_analyzed" },
    "line_id" : { "type" : "integer" },
    "speech_number" : { "type" : "integer" }
 }}}}

注意在引用的文件名前添加"@"符号

相关内容

最新更新