java - Confusion between mappings and types in ElasticSearch -
sorry, i'm new elasticsearch.
http://www.elasticsearch.org/guide/reference/api/admin-indices-put-mapping.html
this document says can "creates mapping called tweet within twitter index"
$ curl -xput 'http://localhost:9200/twitter/tweet/_mapping' -d ' { "tweet" : { "properties" : { "message" : {"type" : "string", "store" : "yes"} } } } ' as told me on es irc channel, /twitter/tweet twitter=index, tweet=type
but happens if following?
$ curl -xput 'http://localhost:9200/twitter/xxx/_mapping' -d ' { "yyy" : { "properties" : { "message" : {"type" : "string", "store" : "yes"} } } } ' if provided type name in url, why should still provide type name in content? if provide type name in content, why can't call url like:
$ curl -xput 'http://localhost:9200/twitter/_mapping' -d ' while reading doc, me says "creates mapping called tweet within twitter index", means xxx mapping name , yyy type name.
thus if there mapping name, there can many "mappings" index
so, in end, xxx , yyy are/should same?
it's not understand doc, think is: - 1 index can have types - types have mapping don't create mapping documentation says, create type, has mapping, or update type's mapping no?
and on index don't want use type (all documents indexed same kind of data), want create mapping index, supposed handle creating 1 type mapping, , use type (in couchdb river example)?
thanks
in current version of elasticsearch search (0.19.4) "yyy" ignored , mapping assigned "xxx" type.
indeed, can think of creating mappings creating types. internally, types represented in terms of mappings , documentation reflects behavior. if records have same type, should treat index index 1 type. type used "namespace" records of different types , therefore it's mandatory. id doesn't uniquely identify record. identify record in elasticsearch, need have index, type , id. why type required paramater operation, example. other operations, if type not specified, elasticsearch assumes want perform operation records of types.
note, types can created dynamically @ time adding record of new type. so, index 1 type index doesn't have second type yet.
Comments
Post a Comment