# Reg multiple Index Types

**URL:** <https://discuss.elastic.co/t/reg-multiple-index-types/10600>\
**Category:** Elasticsearch\
**Created:** [February 2, 2013, 4:18am UTC](https://discuss.elastic.co/t/reg-multiple-index-types/10600 "2013-02-02T04:18:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mars](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@mars](https://discuss.elastic.co/u/mars)\
**Post date:** [February 2, 2013, 4:18am UTC](https://discuss.elastic.co/t/reg-multiple-index-types/10600/1 "2013-02-02T04:18:59Z")

</div>

Hi All,

I have some basic questions regarding the Multiple Index Types. Currently  
we have a single Index and the Document we are creating are becoming bigger  
and bigger.

Ex:

```
       "Employee" : {
              "type" : "object",
              "properties" : {

                             "id" : {"type" : "integer", 

```

"store":"yes"},  
"name" : {"type" : "string",  
"store":"yes", "index":"not\_analyzed"}  
....  
...

```
                             "auditlog" :{
                                       "id" : {"type" : "integer", 

```

"store":"yes"},  
"text" : {"type" : "string",  
"store":"yes", "term\_vector" : "with\_positions\_offsets"},  
"modification\_date" : {"type" :  
"date", "store":"yes", "index" : "not\_analyzed"},  
"modified\_by" : {"type" : "integer", "store":"yes", "index" :  
"not\_analyzed"}  
}

```
              }

       } 

```

Now as we keep adding more and more sub properties for Employee the  
document is growing and more over there can be hundreds of entries for  
auditlog.

When we perform a search on auditlog property for the match we get the  
"Employee" document as search hit and how do we know which auditlog entry  
matched the criteria ?? Does the search return the id of the matched  
auditlog as well

The solution i can think of is to create an index type for audit logs .  
Is this the right approach ? Any comments..

Thanks

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)\
**Post date:** [February 4, 2013, 8:25am UTC](https://discuss.elastic.co/t/reg-multiple-index-types/10600/2 "2013-02-04T08:25:25Z")

</div>

Hello,

You could index the audit logs in a different type, and eventually set the  
other type as its \_parent:

> **[Elastic — The Search AI Company](https://www.elastic.co)**
>
> Power insights and outcomes with The Elastic Search AI Platform. See into your data and find answers that matter with enterprise solutions designed to help you accelerate time to insight. Try Elastic ...

Then you could search in both if you need to. You'll also get more  
efficient indexing when you simply want to add a new audit log. Because you  
won't need to index the whole document.

On the other hand, if you want to search in audit logs and in the "parent"  
docs, that will be slower than with your current mapping. Also, searching  
in audit logs will only return audit logs - so if you want the "parent"  
information too, you'll have to make an extra fetch.

It's a trade-off, because your other option seems to be to look for the  
matching audit log within your application. So I don't know what's right in  
your use-case, it depends on how your typical searches look like.

## Best regards, Radu

[http://sematext.com/](http://sematext.com/) -- Elasticsearch -- Solr -- Lucene

On Sat, Feb 2, 2013 at 6:18 AM, mars [kommineni.sateesh@gmail.com](mailto:kommineni.sateesh@gmail.com) wrote:

> Hi All,
> 
> I have some basic questions regarding the Multiple Index Types.  
> Currently we have a single Index and the Document we are creating are  
> becoming bigger and bigger.
> 
> Ex:
> 
> ```
> "Employee" : {
> "type" : "object",
> "properties" : {
> 
> "id" : {"type" : "integer",
> 
> ```
> 
> "store":"yes"},  
> "name" : {"type" : "string",  
> "store":"yes", "index":"not\_analyzed"}  
> ....  
> ...
> 
> ```
> "auditlog" :{
> "id" : {"type" : "integer",
> 
> ```
> 
> "store":"yes"},  
> "text" : {"type" : "string",  
> "store":"yes", "term\_vector" : "with\_positions\_offsets"},  
> "modification\_date" : {"type" :  
> "date", "store":"yes", "index" : "not\_analyzed"},  
> "modified\_by" : {"type" : "integer", "store":"yes", "index" :  
> "not\_analyzed"}  
> }
> 
> ```
> }
> 
> }
> 
> ```
> 
> Now as we keep adding more and more sub properties for Employee the  
> document is growing and more over there can be hundreds of entries for  
> auditlog.
> 
> When we perform a search on auditlog property for the match we get the  
> "Employee" document as search hit and how do we know which auditlog entry  
> matched the criteria ?? Does the search return the id of the matched  
> auditlog as well
> 
> The solution i can think of is to create an index type for audit logs .  
> Is this the right approach ? Any comments..
> 
> Thanks
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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 6, 2017, 2:53am UTC](https://discuss.elastic.co/t/reg-multiple-index-types/10600/3 "2017-07-06T02:53:12Z")

</div>


