Default mappings for all types in an index (types created on the fly)


(David Klotz) #1

Hi,

i have a bit of a hard time understanding how to specify a default mapping
that is used for all types in an index.

My usage scenario is as follows (inspired by some discussions on this list
that seemed to advocate for one-type-per-user over
one-index-per-user-configurations for scalability reasons when you have
many user-specific documents):

I have an index, named e.g. "contacts", and one predefined type "general"
in that index (which is used for contacts that are not specific to one
user, at the moment only this type has any specific mapping). Then, for
each user, a type "user_someuserid" is created in the same index.

My problem now is that even after quite some reading of the documentation,
I can't figure out how to specify one general default mapping for all types
in an index. I know I could probably do a "put mapping" (with always the
same mapping) when creating the user-specific type, but if possible I want
to avoid that since the types get created on the fly when the first
document is indexed for that user.

The JSON used in all the sub-types of one index will be the same. I already
tried specifying/changing the "_default" mapping, but that didn't seem to
be used for documents in the newly created sub-types.

Any pointers on what (apart from the "put mapping" before the first
document for each user gets indexed) I could look at to specify one mapping
that is valid for all types in an index, even types created in the future?

Cheers,
David

--
David Klotz, Software-Engineer, fileee GmbH

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/5010053f-58a4-48a2-845a-31c49c68c57f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Jörg Prante) #2

The key for the fallback mapping is default (not _default)

Jörg

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHq4Oma0CHuJf0_n7DCJyQtfiZ7KGZK6_LctBOXM0JBkA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(David Klotz-2) #3

Thanks a lot! That was too easy, should have looked more closely
there. I think I even tried with default once, but got confused
(i.e. thought it didn't work) because analyze requests seem to ignore
the default mapping until the first document is indexed in that
index/type.

-David

On Fri, Jan 3, 2014 at 3:24 PM, joergprante@gmail.com
joergprante@gmail.com wrote:

The key for the fallback mapping is default (not _default)

Jörg

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/3YbnxjEUQzk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHq4Oma0CHuJf0_n7DCJyQtfiZ7KGZK6_LctBOXM0JBkA%40mail.gmail.com.

For more options, visit 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAF9xhsdpxrDma5T%2B%3DoqxcX0q1X%3DTB1ef%2BVWULJ_1%3D_m2biAddw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4