# Placing multiple files and data under an index

**URL:** <https://discuss.elastic.co/t/placing-multiple-files-and-data-under-an-index/238630>\
**Category:** Elasticsearch\
**Created:** [June 25, 2020, 9:44am UTC](https://discuss.elastic.co/t/placing-multiple-files-and-data-under-an-index/238630 "2020-06-25T09:44:04Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Romy\_Bobby](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/romy_bobby/32/50393_2.png) [@Romy\_Bobby](https://discuss.elastic.co/u/Romy_Bobby)\
**Post date:** [June 25, 2020, 9:44am UTC](https://discuss.elastic.co/t/placing-multiple-files-and-data-under-an-index/238630/1 "2020-06-25T09:44:04Z")

</div>

Hi,  
I am creating Faq for organisation to enable elastic search in it . I would like to limit my search to each organisation. is it possible to add files and documents under one index so that i can filter according to organisation, so that by passing one index i will be able to only limit search documents and files in only that organisation. please provide a solution

---

<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 25, 2020, 10:02am UTC](https://discuss.elastic.co/t/placing-multiple-files-and-data-under-an-index/238630/2 "2020-06-25T10:02:51Z")

</div>

Yes.

I don't really see what the question is though and how we can help.

---

<div class="post-metadata">

**Author:** ![Romy\_Bobby](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/romy_bobby/32/50393_2.png) [@Romy\_Bobby](https://discuss.elastic.co/u/Romy_Bobby)\
**Post date:** [June 25, 2020, 10:06am UTC](https://discuss.elastic.co/t/placing-multiple-files-and-data-under-an-index/238630/3 "2020-06-25T10:06:44Z")

</div>

see i need to create FAQ files which are searchable by individual organisations .each organisation creates its own FAQs which are uploaded in elastic cloud. if other organisation search for same content the search result should not be found ,only the content added by that organisation should be displayed in search. is there a method for me to add documents under each organisation and search under these organisations only

---

<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 25, 2020, 10:23am UTC](https://discuss.elastic.co/t/placing-multiple-files-and-data-under-an-index/238630/4 "2020-06-25T10:23:12Z")

</div>

Yes.

```auto
POST /faq_comp1/_doc
{
  "company": "1",
  "content": "foo bar"
}
POST /faq_comp2/_doc
{
  "company": "2",
  "content": "foo bar"
}

```

Then

```auto
# Get all from company 1
GET /faq_comp1/_search
# Get all from company 1
GET /faq_comp2/_search
# Get all from all companies
GET /_search

```

Is that what you are asking for?

You can also look at aliases and filtered aliases and do something like:

```auto
POST /faq/_doc
{
  "company": "1",
  "content": "foo bar"
}
POST /faq/_doc
{
  "company": "2",
  "content": "foo bar"
}

```

If you create an alias `faq_comp1` which filters on `"company": "1"` and another one for the second company, you will be able to run:

```auto
# Get all from company 1
GET /faq_comp1/_search
# Get all from company 1
GET /faq_comp2/_search
# Get all from all companies
GET /_search

```

If you want to secure all that, you can secure you indices and your aliases with the built-in security.

---

<div class="post-metadata">

**Author:** ![Romy\_Bobby](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/romy_bobby/32/50393_2.png) [@Romy\_Bobby](https://discuss.elastic.co/u/Romy_Bobby)\
**Post date:** [June 25, 2020, 10:32am UTC](https://discuss.elastic.co/t/placing-multiple-files-and-data-under-an-index/238630/5 "2020-06-25T10:32:05Z")

</div>

is it possible to add many documents under a single index  
like  
POST /faq/\_doc1  
{  
"company": "1",  
"content": "content1"  
}  
POST /faq/\_doc2  
{  
"company": "1",  
"content": "content2"  
}  
so that i can get all documtes by GET /faq/\_search

---

<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 25, 2020, 12:14pm UTC](https://discuss.elastic.co/t/placing-multiple-files-and-data-under-an-index/238630/6 "2020-06-25T12:14:48Z")

</div>

yes.

---

<div class="post-metadata">

**Author:** ![Romy\_Bobby](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/romy_bobby/32/50393_2.png) [@Romy\_Bobby](https://discuss.elastic.co/u/Romy_Bobby)\
**Post date:** [June 25, 2020, 12:16pm UTC](https://discuss.elastic.co/t/placing-multiple-files-and-data-under-an-index/238630/7 "2020-06-25T12:16:30Z")

</div>

is it exactly as i have defined?? one index two docs

---

<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 25, 2020, 12:28pm UTC](https://discuss.elastic.co/t/placing-multiple-files-and-data-under-an-index/238630/8 "2020-06-25T12:28:36Z")

</div>

yes.

See my second example in [Placing multiple files and data under an index](https://discuss.elastic.co/t/placing-multiple-files-and-data-under-an-index/238630/4)

---

<div class="post-metadata">

**Author:** ![Romy\_Bobby](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/romy_bobby/32/50393_2.png) [@Romy\_Bobby](https://discuss.elastic.co/u/Romy_Bobby)\
**Post date:** [June 26, 2020, 5:04am UTC](https://discuss.elastic.co/t/placing-multiple-files-and-data-under-an-index/238630/9 "2020-06-26T05:04:00Z")

</div>

Thank you it works perfectly

---

<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 24, 2020, 5:04am UTC](https://discuss.elastic.co/t/placing-multiple-files-and-data-under-an-index/238630/10 "2020-07-24T05:04:02Z")

</div>

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