# Can we sort search result with type?

**URL:** <https://discuss.elastic.co/t/can-we-sort-search-result-with-type/8142>\
**Category:** Elasticsearch\
**Created:** [June 18, 2012, 8:53am UTC](https://discuss.elastic.co/t/can-we-sort-search-result-with-type/8142 "2012-06-18T08:53:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abhishek\_Jajoria](https://avatars.discourse-cdn.com/v4/letter/a/b5e925/32.png) [@Abhishek\_Jajoria](https://discuss.elastic.co/u/Abhishek_Jajoria)\
**Post date:** [June 18, 2012, 8:53am UTC](https://discuss.elastic.co/t/can-we-sort-search-result-with-type/8142/1 "2012-06-18T08:53:33Z")

</div>

Well I have an Index which contains three types as type1,type2,type3 with  
same fields and then I search on the whole index with search queries .I  
want the result to come ordered with type 1 come first then type 2 and  
then type3.How can we do it in elasticsearch.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [June 18, 2012, 9:05am UTC](https://discuss.elastic.co/t/can-we-sort-search-result-with-type/8142/2 "2012-06-18T09:05:33Z")

</div>

Did you try to order by \_type ?

David.

Le 18 juin 2012 à 10:53, jajoria abhishek [jajoria.abhishek@gmail.com](mailto:jajoria.abhishek@gmail.com) a écrit :

> Well I have an Index which contains three types as type1,type2,type3 with same  
> fields and then I search on the whole index with search queries .I want the  
> result to come ordered with type 1 come first then type 2 and then type3.How  
> can we do it in elasticsearch.

--  
David Pilato  
[http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
Twitter : @dadoonet

---

<div class="post-metadata">

**Author:** ![Abhishek\_Jajoria](https://avatars.discourse-cdn.com/v4/letter/a/b5e925/32.png) [@Abhishek\_Jajoria](https://discuss.elastic.co/u/Abhishek_Jajoria)\
**Post date:** [June 18, 2012, 10:02am UTC](https://discuss.elastic.co/t/can-we-sort-search-result-with-type/8142/3 "2012-06-18T10:02:46Z")

</div>

Is it possible to order by \_ type? well could you give me the syntax to  
write it

On Mon, Jun 18, 2012 at 2:35 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> \*\*
> 
> Did you try to order by \_type ?
> 
> David.
> 
> Le 18 juin 2012 à 10:53, jajoria abhishek [jajoria.abhishek@gmail.com](mailto:jajoria.abhishek@gmail.com) a  
> écrit :
> 
> Well I have an Index which contains three types as type1,type2,type3  
> with same fields and then I search on the whole index with search queries  
> .I want the result to come ordered with type 1 come first then type 2 and  
> then type3.How can we do it in elasticsearch.
> 
> --  
> David Pilato  
> [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> Twitter : @dadoonet

---

<div class="post-metadata">

**Author:** ![Abhishek\_Jajoria](https://avatars.discourse-cdn.com/v4/letter/a/b5e925/32.png) [@Abhishek\_Jajoria](https://discuss.elastic.co/u/Abhishek_Jajoria)\
**Post date:** [June 18, 2012, 10:10am UTC](https://discuss.elastic.co/t/can-we-sort-search-result-with-type/8142/4 "2012-06-18T10:10:15Z")

</div>

I got it sir thanks for your effort

On Mon, Jun 18, 2012 at 3:32 PM, jajoria abhishek \<  
[jajoria.abhishek@gmail.com](mailto:jajoria.abhishek@gmail.com)\> wrote:

> Is it possible to order by \_ type? well could you give me the syntax to  
> write it
> 
> On Mon, Jun 18, 2012 at 2:35 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> 
> > \*\*
> > 
> > Did you try to order by \_type ?
> > 
> > David.
> > 
> > Le 18 juin 2012 à 10:53, jajoria abhishek [jajoria.abhishek@gmail.com](mailto:jajoria.abhishek@gmail.com) a  
> > écrit :
> > 
> > Well I have an Index which contains three types as type1,type2,type3  
> > with same fields and then I search on the whole index with search queries  
> > .I want the result to come ordered with type 1 come first then type 2 and  
> > then type3.How can we do it in elasticsearch.
> > 
> > --  
> > David Pilato  
> > [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> > Twitter : @dadoonet

---

<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, 3:23am UTC](https://discuss.elastic.co/t/can-we-sort-search-result-with-type/8142/5 "2017-07-06T03:23:37Z")

</div>


