# The equivalent query method to search documents by explicit type, as if specified in the URL (like in ES \< 6.x)

**URL:** <https://discuss.elastic.co/t/the-equivalent-query-method-to-search-documents-by-explicit-type-as-if-specified-in-the-url-like-in-es-6-x/156464>\
**Category:** Elasticsearch\
**Created:** [November 13, 2018, 11:59am UTC](https://discuss.elastic.co/t/the-equivalent-query-method-to-search-documents-by-explicit-type-as-if-specified-in-the-url-like-in-es-6-x/156464 "2018-11-13T11:59:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![juiip](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@juiip](https://discuss.elastic.co/u/juiip)\
**Post date:** [November 13, 2018, 11:59am UTC](https://discuss.elastic.co/t/the-equivalent-query-method-to-search-documents-by-explicit-type-as-if-specified-in-the-url-like-in-es-6-x/156464/1 "2018-11-13T11:59:09Z")

</div>

In Elasticsearch \< 6.x, you would search through documents of a specific type within the query url like so:  
`GET index_name/type_name/_search`

However, in Elasticsearch 6.x, with the removal of multiple mapping types, the url can only be:  
`GET index_name/_doc/_search`

I have instead specified the type of the document explicitly like so:  
`"type": "publisher"`

There are numerous ways to retrieve documents by specifying what term you want to select, such as filter, match, must... but I don't know which is the equivalent of specifying the type in the url?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 14, 2018, 4:56am UTC](https://discuss.elastic.co/t/the-equivalent-query-method-to-search-documents-by-explicit-type-as-if-specified-in-the-url-like-in-es-6-x/156464/2 "2018-11-14T04:56:58Z")

</div>

This;

> [@juiip](#):
>
> `"type": "publisher"`

Is just a field to Elasticsearch, so use a filter in the query and you should be good.

---

<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:** [December 12, 2018, 4:56am UTC](https://discuss.elastic.co/t/the-equivalent-query-method-to-search-documents-by-explicit-type-as-if-specified-in-the-url-like-in-es-6-x/156464/3 "2018-12-12T04:56:59Z")

</div>

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