# Sort cross document index or document type

**URL:** <https://discuss.elastic.co/t/sort-cross-document-index-or-document-type/140495>\
**Category:** Elasticsearch\
**Created:** [July 18, 2018, 9:34am UTC](https://discuss.elastic.co/t/sort-cross-document-index-or-document-type/140495 "2018-07-18T09:34:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kratos\_hut](https://avatars.discourse-cdn.com/v4/letter/k/51bf81/32.png) [@kratos\_hut](https://discuss.elastic.co/u/kratos_hut)\
**Post date:** [July 18, 2018, 9:34am UTC](https://discuss.elastic.co/t/sort-cross-document-index-or-document-type/140495/1 "2018-07-18T09:34:15Z")

</div>

Hi all  
Can I use painless inline-script to write a function which sort documents by values from another document index or another document types ?  
Cause I'm using Elasticsearch to filter/search items. And I want to sort these result items by a ordered data set (dataset A) which contains appx 5000 ~ 10000 items. If the item exists in dataset A, it should be appeared in the top of result, with its ordered.  
And cause data set is too big, so I thinks it does not make sense if I pass it as a painless param .  
But actually I'm not sure my way is good or speedy...  
How do you think ?

---

<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:** [August 15, 2018, 9:34am UTC](https://discuss.elastic.co/t/sort-cross-document-index-or-document-type/140495/2 "2018-08-15T09:34:15Z")

</div>

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