OpenSearch/docs/reference/indices/put-mapping.asciidoc
Martijn van Groningen 943b62634c Replaced the multi-field type in favour for the multi fields option that can be set on any core field.
When upgrading to ES 1.0 the existing mappings with a multi-field type automatically get replaced to a core field with the new `fields` option.

If a `multi_field` type-ed field doesn't have a main / default field, a default field will be chosen for the multi fields syntax. The new main field type
will be equal to the first `multi_field` fields' field or type string if no fields have been configured for the `multi_field` field and in both cases
the default index will not be indexed (`index=no` is set on the default field).

If a `multi_field` typed field has a default field, that field will replace the `multi_field` typed field.

Closes to #4521
2014-01-13 09:21:53 +01:00

62 lines
1.9 KiB
Plaintext

[[indices-put-mapping]]
== Put Mapping
The put mapping API allows to register specific mapping definition for a
specific type.
[source,js]
--------------------------------------------------
$ curl -XPUT 'http://localhost:9200/twitter/tweet/_mapping' -d '
{
"tweet" : {
"properties" : {
"message" : {"type" : "string", "store" : true }
}
}
}
'
--------------------------------------------------
The above example creates a mapping called `tweet` within the `twitter`
index. The mapping simply defines that the `message` field should be
stored (by default, fields are not stored, just indexed) so we can
retrieve it later on using selective loading.
More information on how to define type mappings can be found in the
<<mapping,mapping>> section.
[float]
[[merging-conflicts]]
=== Merging & Conflicts
When an existing mapping already exists under the given type, the two
mapping definitions, the one already defined, and the new ones are
merged. The `ignore_conflicts` parameters can be used to control if
conflicts should be ignored or not, by default, it is set to `false`
which means conflicts are *not* ignored.
The definition of conflict is really dependent on the type merged, but
in general, if a different core type is defined, it is considered as a
conflict. New mapping definitions can be added to object types, and core
type mapping can be upgraded by specifying multi fields on a core type.
[float]
[[put-mapping-multi-index]]
=== Multi Index
The put mapping API can be applied to more than one index with a single
call, or even on `_all` the indices.
[source,js]
--------------------------------------------------
$ curl -XPUT 'http://localhost:9200/kimchy,elasticsearch/tweet/_mapping' -d '
{
"tweet" : {
"properties" : {
"message" : {"type" : "string", "store" : true }
}
}
}
'
--------------------------------------------------