CreateIndexRequestBuilder and mappings from JSON (Java)

Hi,

I would like to create my indexes from a template stored in a JSON
file using the CreateIndexRequestBuilder class (Java).

Unfortunately, it seems that the CreateIndexRequestBuilder object
misses a method .source() and is also inconsistent in its members:
setSettings(source) exists but setMappings(source) does not.

Is there any reason for that or I am missing something ?

Thanks,
Jérémie

On Thu, Oct 13, 2011 at 4:39 PM, Jérémie BORDIER
jeremie.bordier@gmail.com wrote:

Hi,

I would like to create my indexes from a template stored in a JSON
file using the CreateIndexRequestBuilder class (Java).

Unfortunately, it seems that the CreateIndexRequestBuilder object
misses a method .source() and is also inconsistent in its members:
setSettings(source) exists but setMappings(source) does not.

Is there any reason for that or I am missing something ?

Thanks,
Jérémie

Additionally, it does not seem to be able to configure Aliases
directly through this call, whereas it is possible through the JSON +
HTTP API.

If anybody has an hint, I'm really struggling with this :slight_smile:

Jérémie

To add mapping you can use CreateIndexRequestBuilder#addMapping(String type,
String mapping)

Regards,
Alexandr Vasilenko

2011/10/13 Jérémie BORDIER jeremie.bordier@gmail.com

On Thu, Oct 13, 2011 at 4:39 PM, Jérémie BORDIER
jeremie.bordier@gmail.com wrote:

Hi,

I would like to create my indexes from a template stored in a JSON
file using the CreateIndexRequestBuilder class (Java).

Unfortunately, it seems that the CreateIndexRequestBuilder object
misses a method .source() and is also inconsistent in its members:
setSettings(source) exists but setMappings(source) does not.

Is there any reason for that or I am missing something ?

Thanks,
Jérémie

Additionally, it does not seem to be able to configure Aliases
directly through this call, whereas it is possible through the JSON +
HTTP API.

If anybody has an hint, I'm really struggling with this :slight_smile:

Jérémie

Hello Alexandr,

Thanks for your answer, unfortunately my original question was how to
fill a CreateIndexRequest using a JSON string, just as you can do an
IndexRequest#source(String json).

Jérémie

On Thu, Oct 13, 2011 at 9:52 PM, Alex Vasilenko aa.vasilenko@gmail.com wrote:

To add mapping you can use CreateIndexRequestBuilder#addMapping(String type,
String mapping)

Regards,
Alexandr Vasilenko

2011/10/13 Jérémie BORDIER jeremie.bordier@gmail.com

On Thu, Oct 13, 2011 at 4:39 PM, Jérémie BORDIER
jeremie.bordier@gmail.com wrote:

Hi,

I would like to create my indexes from a template stored in a JSON
file using the CreateIndexRequestBuilder class (Java).

Unfortunately, it seems that the CreateIndexRequestBuilder object
misses a method .source() and is also inconsistent in its members:
setSettings(source) exists but setMappings(source) does not.

Is there any reason for that or I am missing something ?

Thanks,
Jérémie

Additionally, it does not seem to be able to configure Aliases
directly through this call, whereas it is possible through the JSON +
HTTP API.

If anybody has an hint, I'm really struggling with this :slight_smile:

Jérémie

--
Jérémie 'ahFeel' BORDIER

CreateIndexRequestBuilder has a method called addMapping(String type, String
source), you can use that one to add a mapping defined in json as a String.
Is that what you are after?

On Thu, Oct 13, 2011 at 9:57 PM, Jérémie BORDIER
jeremie.bordier@gmail.comwrote:

Hello Alexandr,

Thanks for your answer, unfortunately my original question was how to
fill a CreateIndexRequest using a JSON string, just as you can do an
IndexRequest#source(String json).

Jérémie

On Thu, Oct 13, 2011 at 9:52 PM, Alex Vasilenko aa.vasilenko@gmail.com
wrote:

To add mapping you can use CreateIndexRequestBuilder#addMapping(String
type,
String mapping)

Regards,
Alexandr Vasilenko

2011/10/13 Jérémie BORDIER jeremie.bordier@gmail.com

On Thu, Oct 13, 2011 at 4:39 PM, Jérémie BORDIER
jeremie.bordier@gmail.com wrote:

Hi,

I would like to create my indexes from a template stored in a JSON
file using the CreateIndexRequestBuilder class (Java).

Unfortunately, it seems that the CreateIndexRequestBuilder object
misses a method .source() and is also inconsistent in its members:
setSettings(source) exists but setMappings(source) does not.

Is there any reason for that or I am missing something ?

Thanks,
Jérémie

Additionally, it does not seem to be able to configure Aliases
directly through this call, whereas it is possible through the JSON +
HTTP API.

If anybody has an hint, I'm really struggling with this :slight_smile:

Jérémie

--
Jérémie 'ahFeel' BORDIER