Curl request return 404 (Not Found)

I'm experiencing a strange problem trying to run an aggregation search through kibana.

If I run this:

curl -H"kbn-version:4.5.0" -H"content-type:application/json" -d'{
        "size": 0,
        "aggs": {
          "issues_without_types": {
            "missing": {
              "field": "issue_tags"
}' -X POST http://localhost:9200/chef/issue/_search

it works, I get what expected.

However, if I run it through Kibana, I mean POST http://localhost:5601/elasticsearch/chef/issue/_search, I get a 404 error:

  "statusCode": 404,
  "error": "Not Found"

What am I doing wrong?
Note that I got this error the first time writing an app plugin for Kibana and using the es service. When I saw the 404 errors from the web console, then I tried to reproduce the error with curl.

Thanks in advance.

Are you including the same headers in the second request as the first?

Yes, exactly as I typed in my post. The only thing that changes is the url.
One more information if that can help:
If I use http://localhost:5601/elasticsearch/*/_search or
http://localhost:5601/elasticsearch/chef/_search it works. I tried with different indexes and it works. The problem seems to be related to the doc_type.

I see. Kibana creates a proxy for only certain Elasticsearch routes. You can see them here:

As you'll notice, we proxy POST /{index}/_search but not POST /{index}/{type}/search. This is why you're seeing a 404.

Hope that helps!

Yes, I figured out something like that. As a workaround I changed my code for not hitting POST /{index}/{type}/search and it's working. Btw, is there any reason for not creating the proxy? Are you going to fix it? Thanks

i am also experiencing the same issue.

  1. what code did you change?
  2. what if i add a proxy like POST /{index}/{type}/{id} ? would that be an error?
    i am trying to post data in a new index using index api.


My workaround consists in including the type as part of the query (_type:
my_doc_type) so to POST /{index}/_search.

Hope this helps.

This solves the problem, but what about adding the proxy, would that break things?

Not sure I understand what you want to do.

There are predefined routes to elastic search as mentioned in :

If i add a new proxy like
createProxy(server, 'POST', '/{index}/{type}/{id}'),
then also i am able to post to elastic search. I am more keen in using this but only if it wont break anything. By break i mean any security that can be now be easily breached on inserting this proxy.

I see. I'm not so expert on Kibana to answer your question.