# Curl request return 404 (Not Found)

**URL:** <https://discuss.elastic.co/t/curl-request-return-404-not-found/57043>\
**Category:** Kibana\
**Created:** [August 2, 2016, 5:19pm UTC](https://discuss.elastic.co/t/curl-request-return-404-not-found/57043 "2016-08-02T17:19:30Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![michele\_crudele](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@michele\_crudele](https://discuss.elastic.co/u/michele_crudele)\
**Post date:** [August 2, 2016, 5:19pm UTC](https://discuss.elastic.co/t/curl-request-return-404-not-found/57043/1 "2016-08-02T17:19:30Z")

</div>

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

If I run this:

```auto
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:

```auto
{
  "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.

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [August 2, 2016, 5:55pm UTC](https://discuss.elastic.co/t/curl-request-return-404-not-found/57043/2 "2016-08-02T17:55:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![michele\_crudele](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@michele\_crudele](https://discuss.elastic.co/u/michele_crudele)\
**Post date:** [August 2, 2016, 7:06pm UTC](https://discuss.elastic.co/t/curl-request-return-404-not-found/57043/3 "2016-08-02T19:06:37Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [August 3, 2016, 2:51pm UTC](https://discuss.elastic.co/t/curl-request-return-404-not-found/57043/4 "2016-08-03T14:51:09Z")

</div>

I see. Kibana creates a proxy for only certain Elasticsearch routes. You can see them here: [https://github.com/elastic/kibana/blob/master/src/core\_plugins/elasticsearch/index.js#L54-L59](https://github.com/elastic/kibana/blob/master/src/core_plugins/elasticsearch/index.js#L54-L59)

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!

---

<div class="post-metadata">

**Author:** ![michele\_crudele](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@michele\_crudele](https://discuss.elastic.co/u/michele_crudele)\
**Post date:** [August 3, 2016, 8:16pm UTC](https://discuss.elastic.co/t/curl-request-return-404-not-found/57043/5 "2016-08-03T20:16:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Shubham\_Agrawal](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@Shubham\_Agrawal](https://discuss.elastic.co/u/Shubham_Agrawal)\
**Post date:** [November 21, 2016, 9:06am UTC](https://discuss.elastic.co/t/curl-request-return-404-not-found/57043/6 "2016-11-21T09:06:33Z")

</div>

Hi,  
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.

Thanks.

---

<div class="post-metadata">

**Author:** ![michele\_crudele](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@michele\_crudele](https://discuss.elastic.co/u/michele_crudele)\
**Post date:** [November 21, 2016, 8:59pm UTC](https://discuss.elastic.co/t/curl-request-return-404-not-found/57043/7 "2016-11-21T20:59:36Z")

</div>

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

Hope this helps.

---

<div class="post-metadata">

**Author:** ![Shubham\_Agrawal](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@Shubham\_Agrawal](https://discuss.elastic.co/u/Shubham_Agrawal)\
**Post date:** [November 22, 2016, 12:30pm UTC](https://discuss.elastic.co/t/curl-request-return-404-not-found/57043/8 "2016-11-22T12:30:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![michele\_crudele](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@michele\_crudele](https://discuss.elastic.co/u/michele_crudele)\
**Post date:** [November 22, 2016, 8:53pm UTC](https://discuss.elastic.co/t/curl-request-return-404-not-found/57043/9 "2016-11-22T20:53:56Z")

</div>

Not sure I understand what you want to do.

---

<div class="post-metadata">

**Author:** ![Shubham\_Agrawal](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@Shubham\_Agrawal](https://discuss.elastic.co/u/Shubham_Agrawal)\
**Post date:** [November 23, 2016, 8:07am UTC](https://discuss.elastic.co/t/curl-request-return-404-not-found/57043/10 "2016-11-23T08:07:22Z")

</div>

HI,  
There are predefined routes to elastic search as mentioned in : [https://github.com/elastic/kibana/blob/master/src/core\_plugins/elasticsearch/index.js#L54-L59](https://github.com/elastic/kibana/blob/master/src/core_plugins/elasticsearch/index.js#L54-L59)

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.

---

<div class="post-metadata">

**Author:** ![michele\_crudele](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@michele\_crudele](https://discuss.elastic.co/u/michele_crudele)\
**Post date:** [November 23, 2016, 10:53pm UTC](https://discuss.elastic.co/t/curl-request-return-404-not-found/57043/11 "2016-11-23T22:53:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:34pm UTC](https://discuss.elastic.co/t/curl-request-return-404-not-found/57043/12 "2017-07-06T13:34:02Z")

</div>


