# Why 404 occured when use es.search() in kibana6.x?

**URL:** <https://discuss.elastic.co/t/why-404-occured-when-use-es-search-in-kibana6-x/117925>\
**Category:** Kibana\
**Created:** [February 1, 2018, 2:53am UTC](https://discuss.elastic.co/t/why-404-occured-when-use-es-search-in-kibana6-x/117925 "2018-02-01T02:53:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lynnic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lynnic/32/27427_2.png) [@Lynnic](https://discuss.elastic.co/u/Lynnic)\
**Post date:** [February 1, 2018, 2:53am UTC](https://discuss.elastic.co/t/why-404-occured-when-use-es-search-in-kibana6-x/117925/1 "2018-02-01T02:53:30Z")

</div>

here is my code  
`

```
es.search({
      index: kbnIndex,
      type: "index-pattern",
      body: {
        query: {
          "ids":
          {
            "type" : "index-pattern",
            "values" : [$scope.vis.indexPattern.id]
          }
        }
      }
  }, function (error, response) {
 } );

```

`  
when I check in chrome dev tool network,  
It says [http://localhost:5601/olv/elasticsearch/.kibana/index-pattern/\_search](http://localhost:5601/olv/elasticsearch/.kibana/index-pattern/_search) 404 not found  
But everything in kibana5.x works fine.  
Does anyone know how to let es.search() work in kibana6.x? thanks very much

---

<div class="post-metadata">

**Author:** ![jbudz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jbudz/32/45922_2.png) [@jbudz](https://discuss.elastic.co/u/jbudz)\
**Post date:** [February 1, 2018, 5:02pm UTC](https://discuss.elastic.co/t/why-404-occured-when-use-es-search-in-kibana6-x/117925/2 "2018-02-01T17:02:08Z")

</div>

Starting in 6.x kibana documents are all a single type, does

```auto
es.search({
      index: kbnIndex,
      type: "doc", //here
      body: {
        query: {
          "ids":
          {
            "type" : "index-pattern",
            "values" : [$scope.vis.indexPattern.id]
          }
        }
      }
  }, function (error, response) {
 } );

```

work for you?

---

<div class="post-metadata">

**Author:** ![Lynnic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lynnic/32/27427_2.png) [@Lynnic](https://discuss.elastic.co/u/Lynnic)\
**Post date:** [February 1, 2018, 5:33pm UTC](https://discuss.elastic.co/t/why-404-occured-when-use-es-search-in-kibana6-x/117925/4 "2018-02-01T17:33:00Z")

</div>

Thanks for replying. I tried but still got 404 on 6.x

```
POST 
http://localhost:5601/ztc/elasticsearch/.kibana/doc/_search
{"query":{"ids":{"type":"index-pattern","values":["3851cd60-0450-11e8-8f86-9312c81e614d"]}}}

```

And I want result like this

```
{
	"took": 0,
	"timed_out": false,
	"_shards": {
		"total": 1,
		"successful": 1,
		"failed": 0
	},
	"hits": {
		"total": 1,
		"max_score": 1.0,
		"hits": [{
			"_index": ".kibana",
			"_type": "index-pattern",
			"_id": "demo-image",
			"_score": 1.0,
			"_source": {
				"title": "demo-image",
				"timeFieldName": "@timestamp",
				"notExpandable": true,
			    "fields": ""
				"fieldFormatMap": "{\"file.length\":{\"id\":\"bytes\"}}"
			}
		}]
	}
}
```

---

<div class="post-metadata">

**Author:** ![jbudz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jbudz/32/45922_2.png) [@jbudz](https://discuss.elastic.co/u/jbudz)\
**Post date:** [February 1, 2018, 6:25pm UTC](https://discuss.elastic.co/t/why-404-occured-when-use-es-search-in-kibana6-x/117925/5 "2018-02-01T18:25:01Z")

</div>

Ah I see, apologies I missed the second type definition. You'll likely want the query to look like this:

```auto
{
  "query": {
    "ids": {
      "type": "doc",
      "values": ["index-pattern:3851cd60-0450-11e8-8f86-9312c81e614d"] 
    }
  }
}

```

```
    query: {
      "ids": {
        "values" : ['index-pattern' + $scope.vis.indexPattern.id]
      }
    }

```

```auto

```

---

<div class="post-metadata">

**Author:** ![Lynnic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lynnic/32/27427_2.png) [@Lynnic](https://discuss.elastic.co/u/Lynnic)\
**Post date:** [February 4, 2018, 8:23am UTC](https://discuss.elastic.co/t/why-404-occured-when-use-es-search-in-kibana6-x/117925/6 "2018-02-04T08:23:54Z")

</div>

thanks a lot! jbudz  
the first query works for me

---

<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:** [March 4, 2018, 8:24am UTC](https://discuss.elastic.co/t/why-404-occured-when-use-es-search-in-kibana6-x/117925/7 "2018-03-04T08:24:40Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
