# Searching by part url

**URL:** <https://discuss.elastic.co/t/searching-by-part-url/52109>\
**Category:** Elasticsearch\
**Created:** [June 7, 2016, 4:06pm UTC](https://discuss.elastic.co/t/searching-by-part-url/52109 "2016-06-07T16:06:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndreyL](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andreyl/32/19365_2.png) [@AndreyL](https://discuss.elastic.co/u/AndreyL)\
**Post date:** [June 7, 2016, 4:06pm UTC](https://discuss.elastic.co/t/searching-by-part-url/52109/1 "2016-06-07T16:06:19Z")

</div>

I have two indices - one contains "document" objects with `_id=<url of the document>`, e.g. `http://site/folder/document_name.doc` ; the other contains "folder" objects with `_id=<url of the folder>`, e.g. `http://site/folder`

In my node.js script I need to match documents to folders, i.e. I search for all folder urls, and then for each of them I search for all documents which urls start with the folder url

I can't seem to be able to construct the right query that will return all documents which \_id starts with `http://site/folder`

Any ideas?

---

<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 5, 2017, 10:45pm UTC](https://discuss.elastic.co/t/searching-by-part-url/52109/2 "2017-07-05T22:45:32Z")

</div>


