# Optinal way to index and search data

**URL:** <https://discuss.elastic.co/t/optinal-way-to-index-and-search-data/266179>\
**Category:** Elasticsearch\
**Created:** [March 4, 2021, 2:57am UTC](https://discuss.elastic.co/t/optinal-way-to-index-and-search-data/266179 "2021-03-04T02:57:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ekrx](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@ekrx](https://discuss.elastic.co/u/ekrx)\
**Post date:** [March 4, 2021, 2:57am UTC](https://discuss.elastic.co/t/optinal-way-to-index-and-search-data/266179/1 "2021-03-04T02:57:53Z")

</div>

Lets say that I am creating an application that will search text from a huge data set.  
Say my document is something like this:

```auto
{
"type": "string", 
"message": "String"
.......
}

```

The type field is used to limit my search to a defined list and pass in the filter query only the types I want to search, then I perform a text search for `message`. I expect my `type` set to grow very big.

I can do 2 things.

- Have one index per type
- One index for all types and many partitions.

If one index per type, do many queries in parallel depending on my desired type, however I will have a huge number of shards.

Else having one index for all types, I'm worried that as data grows, the query time will increase because of all the data the query has to go through and filter types.

What is the best method and where do you find the balance?

Thanks a lot!

---

<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:** [April 1, 2021, 2:58am UTC](https://discuss.elastic.co/t/optinal-way-to-index-and-search-data/266179/2 "2021-04-01T02:58:45Z")

</div>

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