Java API for Mappings


(James Cook) #1

Hi,

How do I use the Java API's to add a mapping to Elastic Search?

At startup, I would like to check and see if a mapping (for a specific set
of types) exists yet. If it doesn't, I will add it.

Also, do I add a mapping file to each node in my cluster, or when I add a
mapping file to one node, does it apply to all nodes?

One more, I want to run the mapping file into the node when it initializes.
If it is going to use mapping files from other nodes, do I have to wait for
a specific event to occur before I can check for the presence of the mapping
file?

Thanks.


(Shay Banon) #2

There is an API to put mappings, it is exposed as a Java API (under the
indices admin API). You can get the current mappings from the cluster state
Java API. Once you put a mapping, it is automatically shared between all the
different nodes (and future nodes) in the cluster and stored as part of the
cluster meta data.

-shay.banon

On Fri, Jul 23, 2010 at 6:06 PM, James Cook jcook@tracermedia.com wrote:

Hi,

How do I use the Java API's to add a mapping to Elastic Search?

At startup, I would like to check and see if a mapping (for a specific set
of types) exists yet. If it doesn't, I will add it.

Also, do I add a mapping file to each node in my cluster, or when I add a
mapping file to one node, does it apply to all nodes?

One more, I want to run the mapping file into the node when it initializes.
If it is going to use mapping files from other nodes, do I have to wait for
a specific event to occur before I can check for the presence of the mapping
file?

Thanks.


(system) #3