-
Notifications
You must be signed in to change notification settings - Fork 25.5k
Closed
Labels
:Data Management/Indices APIsAPIs to create and manage indices and templatesAPIs to create and manage indices and templates
Description
public RolloverRequestBuilder mapping(String type, String source) {
this.request.getCreateIndexRequest().mapping(type, source);
return this;
}
Should be:
public RolloverRequestBuilder mapping(String type, String... source) {
this.request.getCreateIndexRequest().mapping(type, source);
return this;
}
Because I'm trying to create a mapping on each Rollover new index, but I'm getting:
mapping source must be pairs of fieldnames and properties definition.
Looking the API I discovered the following issues:
RolloverRequestBuilder.mapping calls:
public RolloverRequestBuilder mapping(String type, String source) {
this.request.getCreateIndexRequest().mapping(type, source);
return this;
}
but getCreateIndexRequest().mapping has a check:
public CreateIndexRequest mapping(String type, Object... source) {
mapping(type, PutMappingRequest.buildFromSimplifiedDef(type, source));
return this;
}
and XContentBuilder.buildFromSimplifiedDef validate if source is an even value.
public static XContentBuilder buildFromSimplifiedDef(String type, Object... source) {
if (source.length % 2 != 0) {
throw new IllegalArgumentException("mapping source must be pairs of fieldnames and properties definition.");
}
if RolloverRequestBuilder mapping(String type, String source) receive only one parameter as a source string, I will always get an error. is that right? Or I'm getting crazy. I have tried to add my mapping on rolling index and I'm always getting an error.
Thanks,
Fabricio
Metadata
Metadata
Assignees
Labels
:Data Management/Indices APIsAPIs to create and manage indices and templatesAPIs to create and manage indices and templates