Elasticsearch curl:(7)无法连接到主机 [英] Elasticsearch curl: (7) couldn't connect to host

查看:2368
本文介绍了Elasticsearch curl:(7)无法连接到主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试用mongodb进行弹性搜索。



我已经按照步骤从
http://satishgandham.com/2012/09/a-complete-guide-to-integrating- mongodb-with-elastic-search /



但是当我尝试通过

设置索引时

  curl -XPUT'http:// localhost:9200 / _river / mongodb / _meta'-d'
{
type:mongodb,
mongodb:{
db:smmc-dart,
collection:smmc_collectionDetails
},
index:{
name:caseName,
type:string
}
}'

我收到错误

  curl:(7)无法连接到主机

当我尝试 http:// localhost:9200 / 在我的浏览器上显示

  {
status:200,
name Nicholas Scratch,
version:{
number:1.1.0,
build_hash:2181e113dea80b4a9e31e58e9686658a2d46e363,
build_timestamp: -03-25T15:59:51Z,
build_snapshot:false,
lucene_version:4.7
},
tagline搜索
}

我也在终端试过了

  curl -XGET http://10.20.4.220:9200/ 

结果

  curl:(7)无法连接到主机



为什么会发生这种情况,以及如何修复它。

解决方案

在我的Mac OS X,我使用 127.0.0.1:9200 / 而不是 http: 9200 / 因为我有同样的问题。



我认为当你使用命令终端替换localhost它的IPv6地址,我不知道curl支持。



请检查并通知我。


I was trying out elastic search with mongodb.

I have followed steps from http://satishgandham.com/2012/09/a-complete-guide-to-integrating-mongodb-with-elastic-search/

But when I try to set index by

curl -XPUT 'http://localhost:9200/_river/mongodb/_meta' -d '
{
    "type": "mongodb",
    "mongodb": {
        "db": "smmc-dart",
        "collection": "smmc_collectionDetails"
    },
    "index": {
        "name": "caseName",
        "type": "string"
    }
}'

I'm getting error

curl: (7) couldn't connect to host

When I tried http://localhost:9200/ on my browser it shows

{
  "status" : 200,
  "name" : "Nicholas Scratch",
  "version" : {
    "number" : "1.1.0",
    "build_hash" : "2181e113dea80b4a9e31e58e9686658a2d46e363",
    "build_timestamp" : "2014-03-25T15:59:51Z",
    "build_snapshot" : false,
    "lucene_version" : "4.7"
  },
  "tagline" : "You Know, for Search"
}

I also tried this in terminal

curl -XGET http://10.20.4.220:9200/

It resulted

curl: (7) couldn't connect to host

Why is this happening and how to fix it.

解决方案

On my Mac OS X, I use 127.0.0.1:9200/ instead of http://localhost:9200/ cause I had the same problem.

I think that when you use the command the terminal replaces the localhost by it's IPv6 address and I'm not sure that curl supports that.

Please check and let me know.

这篇关于Elasticsearch curl:(7)无法连接到主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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