bonatakis  
                (Jiannis Bonatakis)
               
                 
              
                  
                    May 20, 2016,  5:55pm
                   
                   
              1 
               
             
            
              i try to make a request to elasticsearch with curl to the kibana interface. 
curl -u user:password -i https://ip:5601/elasticsearch/_search?pretty -d '{ "aggs": { "allhosts": {"terms": {"field":"host", "size":30 } } } }'
the response of the above is
> HTTP/1.1 400 Bad Request
> Date: Fri, 20 May 2016 17:40:38 GMT
> Server: Apache/2.4.10 (Debian)
> kbn-name: kibana
> kbn-version: 4.5.0
> content-type: application/json; charset=utf-8
> cache-control: no-cache
> content-length: 79
> Connection: close
> {"statusCode":400,"error":"Bad Request","message":"Missing kbn-version header"}
 
Elasticsearch version is 2.3.2. 
the ip is the vip of the cluster.
The query works pretty fine if I ssh to the node which run the elasticsearch. Any idea what s possible wrong?
             
            
               
               
               
            
            
           
          
            
              
                jbudz  
                (Jon Budzenski)
               
              
                  
                    May 20, 2016,  6:10pm
                   
                   
              2 
               
             
            
              Kibana expects the header 'kbn-version' to be passed on requests, it's used to protect against xsrf attacks.
adding -H kbn-version:4.5.0 should get around that error.
             
            
               
               
               
            
            
           
          
            
              
                bonatakis  
                (Jiannis Bonatakis)
               
              
                  
                    May 24, 2016,  1:46pm
                   
                   
              3 
               
             
            
              i tried that and surprisely i get another odd respond. it is a 404 http status but I can ensure you that the  the path is right
             
            
               
               
               
            
            
           
          
            
              
                bonatakis  
                (Jiannis Bonatakis)
               
              
                  
                    May 24, 2016,  1:53pm
                   
                   
              4 
               
             
            
              i think it has been solved. thanks jbudz.
curl -u kibana:$pw -H "kbn-version: 4.5.0" https://:5601$host/elasticsearch/*/_search?pretty  -d '{"query":{"match":{"type":"cinder"}}}' -i
HTTP/1.1 200 OK 
Date: Tue, 24 May 2016 13:43:01 GMT 
Server: Apache/2.4.10 (Debian) 
content-type: application/json; charset=UTF-8 
content-length: 16665 
kbn-name: kibana 
kbn-version: 4.5.0 
cache-control: no-cache