[ML] Removed norelease: Don't specify an id for certain documents, but let ES generate an id.

This norelease can be removed, because we no longer create indices automatically when missing, but use index templates.

Original commit: elastic/x-pack-elasticsearch@b6880ce7b7
This commit is contained in:
Martijn van Groningen 2017-02-28 14:30:10 +01:00
parent 759f0b1281
commit b7b24ed877
3 changed files with 4 additions and 10 deletions

View File

@ -11,9 +11,7 @@ import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.bulk.BulkResponse;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.UUIDs;
import org.elasticsearch.common.component.AbstractComponent;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.ToXContent;
@ -343,8 +341,7 @@ public class JobResultsPersister extends AbstractComponent {
this.jobId = jobId;
this.object = object;
this.type = type;
// TODO: (norelease): Fix the assertion tripping in internal engine for index requests without an id being retried:
this.id = id != null ? id : UUIDs.base64UUID();
this.id = id;
}
boolean persist(String indexName) {

View File

@ -11,7 +11,6 @@ import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.UUIDs;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.xcontent.ToXContent;
import org.elasticsearch.common.xcontent.XContentBuilder;
@ -47,8 +46,7 @@ public class Auditor {
}
private void indexDoc(String type, ToXContent toXContent) {
// TODO: (norelease): Fix the assertion tripping in internal engine for index requests without an id being retried:
client.prepareIndex(NOTIFICATIONS_INDEX, type, UUIDs.base64UUID())
client.prepareIndex(NOTIFICATIONS_INDEX, type)
.setSource(toXContentBuilder(toXContent))
.execute(new ActionListener<IndexResponse>() {
@Override

View File

@ -21,7 +21,6 @@ import org.mockito.ArgumentCaptor;
import java.io.IOException;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@ -88,9 +87,9 @@ public class AuditorTests extends ESTestCase {
IndexRequestBuilder indexRequestBuilder = mock(IndexRequestBuilder.class);
when(indexRequestBuilder.setSource(jsonCaptor.capture())).thenReturn(indexRequestBuilder);
when(indexRequestBuilder.execute()).thenReturn(indexResponse);
when(client.prepareIndex(indexCaptor.capture(), typeCaptor.capture(), any()))
when(client.prepareIndex(indexCaptor.capture(), typeCaptor.capture()))
.thenReturn(indexRequestBuilder);
when(client.prepareIndex(indexCaptor.capture(), typeCaptor.capture(), any()))
when(client.prepareIndex(indexCaptor.capture(), typeCaptor.capture()))
.thenReturn(indexRequestBuilder);
}