Improved CreateIndexRequest and CreateIndexRequestBuilder javadocs

This commit is contained in:
Luca Cavanna 2014-01-27 13:44:43 +01:00
parent c4edf15633
commit 2ad7f2b8a6
2 changed files with 21 additions and 9 deletions

View File

@ -108,7 +108,7 @@ public class CreateIndexRequest extends AcknowledgedRequest<CreateIndexRequest>
} }
/** /**
* The settings to created the index with. * The settings to create the index with.
*/ */
Settings settings() { Settings settings() {
return settings; return settings;
@ -130,7 +130,7 @@ public class CreateIndexRequest extends AcknowledgedRequest<CreateIndexRequest>
} }
/** /**
* The settings to created the index with. * The settings to create the index with.
*/ */
public CreateIndexRequest settings(Settings settings) { public CreateIndexRequest settings(Settings settings) {
this.settings = settings; this.settings = settings;
@ -138,7 +138,7 @@ public class CreateIndexRequest extends AcknowledgedRequest<CreateIndexRequest>
} }
/** /**
* The settings to created the index with. * The settings to create the index with.
*/ */
public CreateIndexRequest settings(Settings.Builder settings) { public CreateIndexRequest settings(Settings.Builder settings) {
this.settings = settings.build(); this.settings = settings.build();
@ -146,7 +146,7 @@ public class CreateIndexRequest extends AcknowledgedRequest<CreateIndexRequest>
} }
/** /**
* The settings to crete the index with (either json/yaml/properties format) * The settings to create the index with (either json/yaml/properties format)
*/ */
public CreateIndexRequest settings(String source) { public CreateIndexRequest settings(String source) {
this.settings = ImmutableSettings.settingsBuilder().loadFromSource(source).build(); this.settings = ImmutableSettings.settingsBuilder().loadFromSource(source).build();
@ -166,7 +166,7 @@ public class CreateIndexRequest extends AcknowledgedRequest<CreateIndexRequest>
} }
/** /**
* The settings to crete the index with (either json/yaml/properties format) * The settings to create the index with (either json/yaml/properties format)
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public CreateIndexRequest settings(Map source) { public CreateIndexRequest settings(Map source) {
@ -265,6 +265,9 @@ public class CreateIndexRequest extends AcknowledgedRequest<CreateIndexRequest>
return source(source, 0, source.length); return source(source, 0, source.length);
} }
/**
* Sets the settings and mappings as a single source.
*/
public CreateIndexRequest source(byte[] source, int offset, int length) { public CreateIndexRequest source(byte[] source, int offset, int length) {
return source(new BytesArray(source, offset, length)); return source(new BytesArray(source, offset, length));
} }
@ -327,6 +330,9 @@ public class CreateIndexRequest extends AcknowledgedRequest<CreateIndexRequest>
return this.mappings; return this.mappings;
} }
/**
* Adds custom metadata to the index to be created.
*/
public CreateIndexRequest custom(IndexMetaData.Custom custom) { public CreateIndexRequest custom(IndexMetaData.Custom custom) {
customs.put(custom.type(), custom); customs.put(custom.type(), custom);
return this; return this;

View File

@ -43,13 +43,16 @@ public class CreateIndexRequestBuilder extends AcknowledgedRequestBuilder<Create
super((InternalIndicesAdminClient) indicesClient, new CreateIndexRequest(index)); super((InternalIndicesAdminClient) indicesClient, new CreateIndexRequest(index));
} }
/**
* Sets the name of the index to be created
*/
public CreateIndexRequestBuilder setIndex(String index) { public CreateIndexRequestBuilder setIndex(String index) {
request.index(index); request.index(index);
return this; return this;
} }
/** /**
* The settings to created the index with. * The settings to create the index with.
*/ */
public CreateIndexRequestBuilder setSettings(Settings settings) { public CreateIndexRequestBuilder setSettings(Settings settings) {
request.settings(settings); request.settings(settings);
@ -57,7 +60,7 @@ public class CreateIndexRequestBuilder extends AcknowledgedRequestBuilder<Create
} }
/** /**
* The settings to created the index with. * The settings to create the index with.
*/ */
public CreateIndexRequestBuilder setSettings(Settings.Builder settings) { public CreateIndexRequestBuilder setSettings(Settings.Builder settings) {
request.settings(settings); request.settings(settings);
@ -73,7 +76,7 @@ public class CreateIndexRequestBuilder extends AcknowledgedRequestBuilder<Create
} }
/** /**
* The settings to crete the index with (either json/yaml/properties format) * The settings to create the index with (either json/yaml/properties format)
*/ */
public CreateIndexRequestBuilder setSettings(String source) { public CreateIndexRequestBuilder setSettings(String source) {
request.settings(source); request.settings(source);
@ -89,7 +92,7 @@ public class CreateIndexRequestBuilder extends AcknowledgedRequestBuilder<Create
} }
/** /**
* The settings to crete the index with (either json/yaml/properties format) * The settings to create the index with (either json/yaml/properties format)
*/ */
public CreateIndexRequestBuilder setSettings(Map<String, Object> source) { public CreateIndexRequestBuilder setSettings(Map<String, Object> source) {
request.settings(source); request.settings(source);
@ -186,6 +189,9 @@ public class CreateIndexRequestBuilder extends AcknowledgedRequestBuilder<Create
return this; return this;
} }
/**
* Adds custom metadata to the index to be created.
*/
public CreateIndexRequestBuilder addCustom(IndexMetaData.Custom custom) { public CreateIndexRequestBuilder addCustom(IndexMetaData.Custom custom) {
request.custom(custom); request.custom(custom);
return this; return this;