Index with different document types


Suppose I have in total 3000 mappings (mix of text, date, numerics) for an index and have documents using a subset of those mappings like this:

doc1 {
  field_1 ...
  field_2 ...
  field_3 ...

doc2 {


  • Is this pattern recommended for a single index or multiple indices would be better w/ alias? The examples I see are usually adding one type of document to an index, so wondering if there is any performance benefit here.
  • What about dynamic vs static mapping? Any difference it has on indexing?

@ktech007 With dynamic mapping, Elasticsearch defines your mapping based on the structure of your incoming documents. This is helpful for exploring data even when you don't have the structure ahead of time. With explicit mapping, it allows you to have more control over how your documents will be structured. Here, you define the mapping that will be applied to all incoming documents.
Whether you use explicit or dynamic, the mapping is set upon ingestion and cannot be changed. If you want the documents to be structured in three different ways then that would require three different indices with their on corresponding mappings. Each index will have its own single mapping.

I think most people put "similar" documents in one index.
The main purpose is to be able to search for most relevant documents with the smallest set, which produces the fastest query.
And grouping similar documents into one index achieves this goal.

It's really your call on how you want to break up this logical set. And it often changes when your document count grows.

sounds good. thank you.

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