How to apply default-mapping.json from classpath to an in-memory elasticsearch instance

Hi together,

if one starts a standalone elasticsearch instance and places a
default-mapping.json inside the conf directory, those default mappings are
applied during index creation.

How do I achieve this behavior in a java testing environment where I start
the elasticsearch instance in memory?

The only solution I found is to apply the mapping during index creation.
But I don't want to create the index programmatically.

Now I'm looking for a way to achieve somthing like this:

nodeBuilder.getSettings().loadFromClasspath("elasticsearch/elasticsearch.properties");
nodeBuilder.getSettings().loadFromClasspath("elasticsearch/default-mapping.json");
nodeBuilder.getSettings().loadFromClasspath("elasticsearch/logging.yml");

Any Ideas?

Regards, Daniel

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Even when you start an embedded node it still tries to load configuration
files from configuration directory. So, you can simply point node to the
correct config directory by adding "path.conf" setting to the node settings
when you build your node. Alternatively, you can specify location of
default mapping using "index.mapper.default_mapping_location" setting.

On Tuesday, January 29, 2013 11:48:14 AM UTC-5, dawi wrote:

Hi together,

if one starts a standalone elasticsearch instance and places a
default-mapping.json inside the conf directory, those default mappings are
applied during index creation.

How do I achieve this behavior in a java testing environment where I start
the elasticsearch instance in memory?

The only solution I found is to apply the mapping during index creation.
But I don't want to create the index programmatically.

Now I'm looking for a way to achieve somthing like this:

nodeBuilder.getSettings().loadFromClasspath("elasticsearch/elasticsearch.properties");

nodeBuilder.getSettings().loadFromClasspath("elasticsearch/default-mapping.json");
nodeBuilder.getSettings().loadFromClasspath("elasticsearch/logging.yml");

Any Ideas?

Regards, Daniel

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

Hi Igor,

I am looking for a solution to load those settings from classpath for
example to have a default-mapping.json inside a jar file.

Regards,
Daniel

Am Samstag, 2. Februar 2013 02:38:22 UTC+1 schrieb Igor Motov:

Even when you start an embedded node it still tries to load configuration
files from configuration directory. So, you can simply point node to the
correct config directory by adding "path.conf" setting to the node settings
when you build your node. Alternatively, you can specify location of
default mapping using "index.mapper.default_mapping_location" setting.

On Tuesday, January 29, 2013 11:48:14 AM UTC-5, dawi wrote:

Hi together,

if one starts a standalone elasticsearch instance and places a
default-mapping.json inside the conf directory, those default mappings are
applied during index creation.

How do I achieve this behavior in a java testing environment where I
start the elasticsearch instance in memory?

The only solution I found is to apply the mapping during index creation.
But I don't want to create the index programmatically.

Now I'm looking for a way to achieve somthing like this:

nodeBuilder.getSettings().loadFromClasspath("elasticsearch/elasticsearch.properties");

nodeBuilder.getSettings().loadFromClasspath("elasticsearch/default-mapping.json");
nodeBuilder.getSettings().loadFromClasspath("elasticsearch/logging.yml");

Any Ideas?

Regards, Daniel

--
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.
For more options, visit https://groups.google.com/groups/opt_out.

It should work for classpath resources as well. When elasticsearch loads
config resources, it tries to resolve them using file system first, but if
it cannot find these files in the file system it tries to load them from
classpath. Check Environment.resolveConfighttps://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/env/Environment.java#L170 to
see how it works.

On Wednesday, February 6, 2013 6:05:05 PM UTC-5, dawi wrote:

Hi Igor,

I am looking for a solution to load those settings from classpath for
example to have a default-mapping.json inside a jar file.

Regards,
Daniel

Am Samstag, 2. Februar 2013 02:38:22 UTC+1 schrieb Igor Motov:

Even when you start an embedded node it still tries to load configuration
files from configuration directory. So, you can simply point node to the
correct config directory by adding "path.conf" setting to the node settings
when you build your node. Alternatively, you can specify location of
default mapping using "index.mapper.default_mapping_location" setting.

On Tuesday, January 29, 2013 11:48:14 AM UTC-5, dawi wrote:

Hi together,

if one starts a standalone elasticsearch instance and places a
default-mapping.json inside the conf directory, those default mappings are
applied during index creation.

How do I achieve this behavior in a java testing environment where I
start the elasticsearch instance in memory?

The only solution I found is to apply the mapping during index creation.
But I don't want to create the index programmatically.

Now I'm looking for a way to achieve somthing like this:

nodeBuilder.getSettings().loadFromClasspath("elasticsearch/elasticsearch.properties");

nodeBuilder.getSettings().loadFromClasspath("elasticsearch/default-mapping.json");
nodeBuilder.getSettings().loadFromClasspath("elasticsearch/logging.yml");

Any Ideas?

Regards, Daniel

--
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.
For more options, visit https://groups.google.com/groups/opt_out.