elasticsearch get/正在返回html错误,而不是json响应

pcrecxhr  于 2021-06-10  发布在  ElasticSearch
关注(0)|答案(3)|浏览(341)

我最近在rhel上安装了elasticsearch,并在配置文件中设置了节点名。后来,我用 sudo systemctl start elasticsearch.service 服务似乎正在按照status命令运行

sudo systemctl status elasticsearch.service
● elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2020-11-25 14:59:13 CET; 2h 37min ago
     Docs: https://www.elastic.co
 Main PID: 6565 (java)
   CGroup: /system.slice/elasticsearch.service
           ├─6565 /usr/share/elasticsearch/jdk/bin/java -Xshare:auto -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=t...
           └─6754 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller
Nov 25 14:59:05 hdm18 systemd[1]: Starting Elasticsearch...
Nov 25 14:59:13 hdm18 systemd[1]: Started Elasticsearch.

但是get的输出是返回一个html页面而不是json消息

curl -X GET "localhost:9200/?pretty"
<!-- IE friendly error message walkround.        
     if error message from server is less than   
     512 bytes IE v5+ will use its own error     
     message instead of the one returned by      
     server.                                 --> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
  <head>
    <meta
    enter code here

知道我做错什么了吗?

nhhxz33t

nhhxz33t1#

您使用的是kibana dev console语法,而您似乎在尝试使用curl。查看教程时请检查curl语法。
对您来说,最简单的方法可能是使用kibana中的dev控制台。

nwlls2ji

nwlls2ji2#

我相信您从这个官方链接复制了您的命令,但是如果您复制curl命令 curl -X GET "localhost:9200/?pretty". 上面和下面将打印正确的输出。

{
  "name" : "Opster",
  "cluster_name" : "es_710",
  "cluster_uuid" : "SZ-nvW_KSOaudmfB6e0oFg",
  "version" : {
    "number" : "7.10.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "51e9d6f22758d0374a0f3f5c6e8f3a7997850f96",
    "build_date" : "2020-11-09T21:30:33.964949Z",
    "build_snapshot" : false,
    "lucene_version" : "8.7.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}
kzipqqlq

kzipqqlq3#

通过使用

unset http_proxy
unset https_proxy

相关问题