How can I store elasticsearch + mapping settings in a single file (e.g. schema.xml for Solr)

How to save elasticsearch + mapping settings in a single file (e.g. schema.xml for Solr)? Currently, when I want to make changes to my mapping, I need to remove the index settings and start over. Did I miss something?

At the moment I do not have a large dataset. But in preparation for the large amount of data that will be indexed, I would like to be able to change the settings, and some like reindex, without starting completely completely every time. Is this possible, and if so, how?

+8
search elasticsearch
source share
2 answers

These are actually several questions disguised as one. Nevertheless:

How to save elasticsearch + mapping settings in a single file (e.g. schema.xml for Solr)?

First, note that you do not need to specify a mapping for many types, such as dates, integers, or even strings (when the analyzer is right for you by default).

You can save settings and mappings in various ways, in ElasticSearch < 1.7 :

Currently, when I want to make changes to my mapping, I need to remove the index settings and start over. Did I miss something?

You need to reindex the data when you change the display for an existing field. Once your documents are indexed, the engine must reindex them in order to use the new mapping.

Please note that you can update index parameters in certain cases, for example number_of_replicas , on the fly.

I would like to be able to change the settings, and some like reindex, without starting completely fresh every time. Is this possible, and if so, how?

As said: you have to reindex your documents if you want to use a completely new mapping for them.

If you add, but do not change the mapping, you can update the mapping, and new documents will pick it up when indexing.

+16
source share

Since Elasticsearch 2.0 :

You can no longer specify mappings in files in the config directory.

Find the documentation link here .

It is also no longer possible to store index templates in the configuration location ( path.conf ) in the templates directory.

path.conf ( /etc/default/elasticsearch by default on Ubuntu) now only stores environment variables, including heap size, file descriptors.

You need to create your templates using curl .

If you are really desperate, you can create your indexes and then back up your data directory and then use it as your β€œtemplate” for new Elasticsearch clusters.

0
source share

All Articles