Hi,
I would like to be able to store mappings for my indices in a json/yml
file, so that whenever I add a document to the index, I don't have to
specify a mapping via the put_mapping api call. The documentation
seems to have multiple places for configuring something like that:
The thing is that none of these options seem to work. Does anyone
have a working mapping file that works? I'm using ES 0.14.1.
didier
Hi,
I haven't been using default-mapping.json file so far but see my comments on
the other options below:
On Sat, Jan 8, 2011 at 4:07 AM, didier deshommes dfdeshom@gmail.com wrote:
Hi,
I would like to be able to store mappings for my indices in a json/yml
file, so that whenever I add a document to the index, I don't have to
specify a mapping via the put_mapping api call. The documentation
seems to have multiple places for configuring something like that:
http://www.elasticsearch.com/docs/elasticsearch/mapping/builtin_mappings/
: "Mappings can be defined within files called [mapping_name].json and
be placed either under config/mappings/_default location, or under
config/mappings/[index_name] (for mappings that should be associated
only with a specific index)." There seems to be conflicting
information about how to store the name of the mapping. Is it
config/mapping/[index_name] or config/mapping/[index_name].json ?
take the following file foo,json:
{
"foo" : {
"properties" : {
"howdy" : { "type" : "string", "index" : "not_analyzed" }
}
}
}
Placing this file into
config/mappings/_default/foo.json
means that whenever a new index is created it will be created with mappings
for foo type.
Placing it to
config/mappings/bar/foo.json
means that whenever an index called bar is created it will be created with
mappings for foo type.
The thing is that none of these options seem to work. Does anyone
have a working mapping file that works? I'm using ES 0.14.1.
You can also take a look at index templates:
http://www.elasticsearch.com/docs/elasticsearch/rest_api/admin/indices/templates/
With index templates you PUT the mapping into cluster once and it becomes
part of the cluster metadata and is available to any newly started node that
joins the cluster.
didier
Regards,
Lukas
On Mon, Jan 10, 2011 at 4:07 AM, Lukáš Vlček lukas.vlcek@gmail.com wrote:
take the following file foo,json:
{
"foo" : {
"properties" : {
"howdy" : { "type" : "string", "index" : "not_analyzed" }
}
}
}
Placing this file into
config/mappings/_default/foo.json
means that whenever a new index is created it will be created with mappings
for foo type.
Placing it to
config/mappings/bar/foo.json
means that whenever an index called bar is created it will be created with
mappings for foo type.
Hi,
Thanks for the clarifications, I didn't realize that
config/mappings/_default/ was actually a directory. Everything worked
out beautifully.
The thing is that none of these options seem to work. Does anyone
have a working mapping file that works? I'm using ES 0.14.1.
You can also take a look at index
templates: http://www.elasticsearch.com/docs/elasticsearch/rest_api/admin/indices/templates/
With index templates you PUT the mapping into cluster once and it becomes
part of the cluster metadata and is available to any newly started node that
joins the cluster.
Thanks! good to know.
didier