使用ID和密码连接到服务器

时间:2019-03-21 08:42:35

标签: json elasticsearch

我是json的新手,我试图研究可能是什么问题,但是没有运气。

我正在使用Kibana(开发工具),并且我必须连接到丹麦公司注册处,因此我需要提取数据。

他们提供了以下代码进行连接:

curl -u "ID:Password" -XGET http://distribution.virk.dk/cvr-permanent/_mapping

但是我得到了这个结果

 {
"error" : {
"root_cause" : [
  {
    "type" : "index_not_found_exception",
    "reason" : "no such index",
    "resource.type" : "index_or_alias",
    "resource.id" : "cvr-permanent",
    "index_uuid" : "_na_",
    "index" : "cvr-permanent"
  }
],
"type" : "index_not_found_exception",
"reason" : "no such index",
"resource.type" : "index_or_alias",
"resource.id" : "cvr-permanent",
"index_uuid" : "_na_",
"index" : "cvr-permanent"
  },
    "status" : 404
}

在其启动“如何”文档中,他们也建议这样做(随后是其他命令):

curl -XPOST -u “ID:Password” http://distribution.virk.dk/cvr-permanent/virksomhed/_search -d '
{
"_source":["Vrvirksomhed.virksomhedMetadata.nyesteNavn.navn"],
"query":{"term":{"Vrvirksomhed.cvrNummer":"12345678"}}
}

但是我得到相同的结果。

有人能认出我所缺少的吗? 谢谢!

1 个答案:

答案 0 :(得分:0)

您可能已经知道了,但是当尝试访问CVR时,这对我有用。他们的文档有点混乱,而且不是最新的。我成功运行了以下命令:

curl -XPOST -H "Content-Type: application/json" -u "username:password" -d'
{ "_source": ["Vrvirksomhed.virksomhedMetadata.nyesteNavn.navn"],
  "query": {
    "term": {
      "Vrvirksomhed.cvrNummer": 12345678
    }
  }
}' http://distribution.virk.dk/cvr-permanent/_search

似乎您的端点URL中有很多“病毒”。

亲切的问候, 迈克尔