# Prioritising pages belonging to a folder

**URL:** <https://discuss.elastic.co/t/prioritising-pages-belonging-to-a-folder/209889>\
**Category:** Elasticsearch\
**Created:** [November 28, 2019, 4:27pm UTC](https://discuss.elastic.co/t/prioritising-pages-belonging-to-a-folder/209889 "2019-11-28T16:27:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![thack](https://avatars.discourse-cdn.com/v4/letter/t/2acd7d/32.png) [@thack](https://discuss.elastic.co/u/thack)\
**Post date:** [November 28, 2019, 4:27pm UTC](https://discuss.elastic.co/t/prioritising-pages-belonging-to-a-folder/209889/1 "2019-11-28T16:27:54Z")

</div>

We have a folder inside which are all our course pages.

That folder is /course/

How do I prioritise all content in this folder when corresponding with search queries?

For example, if someone types in 'art', I want our art courses to appear before our art gallery.

Many thanks!

---

<div class="post-metadata">

**Author:** ![gabriel\_tessier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gabriel_tessier/32/27911_2.png) [@gabriel\_tessier](https://discuss.elastic.co/u/gabriel_tessier)\
**Post date:** [November 29, 2019, 4:23am UTC](https://discuss.elastic.co/t/prioritising-pages-belonging-to-a-folder/209889/2 "2019-11-29T04:23:00Z")

</div>

Hi @thack,

The more simple and if you use logstash or ingest is adding a weight field depends on the folder so let's say course have 2 points gallery have 1 etc... so you can sort on this field or mix with other fields to sort on.  
But you need to reindex your data to set the weight.

---

<div class="post-metadata">

**Author:** ![xeraa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xeraa/32/48181_2.png) [@xeraa](https://discuss.elastic.co/u/xeraa)\
**Post date:** [November 30, 2019, 7:15pm UTC](https://discuss.elastic.co/t/prioritising-pages-belonging-to-a-folder/209889/3 "2019-11-30T19:15:08Z")

</div>

Can you provide two sample documents (one with and one without the course folder) and your query?

I'd assume you could build this with a [should clause](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/query-dsl-bool-query.html) on the course folder in addition to a must for the search term, but it will be much easier if we don't have to guess your current document and query structure.

---

<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 28, 2019, 7:15pm UTC](https://discuss.elastic.co/t/prioritising-pages-belonging-to-a-folder/209889/4 "2019-12-28T19:15:12Z")

</div>

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