Changed internal indices naming pattern
The `.watch_history` indices names should be aligned with logstash and marvel indices patterns so changing them to `.watch_history-YY.MM.dd` Closes elastic/elasticsearch#387 Original commit: elastic/x-pack-elasticsearch@20baa1018f
This commit is contained in:
parent
5687c91bf6
commit
70cc41d710
|
@ -48,11 +48,11 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
|
|||
*/
|
||||
public class HistoryStore extends AbstractComponent {
|
||||
|
||||
public static final String INDEX_PREFIX = ".watch_history_";
|
||||
public static final String INDEX_PREFIX = ".watch_history-";
|
||||
public static final String DOC_TYPE = "watch_record";
|
||||
public static final String INDEX_TEMPLATE_NAME = "watch_history";
|
||||
|
||||
static final DateTimeFormatter indexTimeFormat = DateTimeFormat.forPattern("YYYY-MM-dd");
|
||||
static final DateTimeFormatter indexTimeFormat = DateTimeFormat.forPattern("YYYY.MM.dd");
|
||||
|
||||
private final ClientProxy client;
|
||||
private final TemplateUtils templateUtils;
|
||||
|
|
|
@ -83,7 +83,7 @@ public class HistoryStoreTests extends ElasticsearchTestCase {
|
|||
long version = randomLong();
|
||||
when(indexResponse.getVersion()).thenReturn(version);
|
||||
|
||||
when(clientProxy.index(indexRequest(".watch_history_1970-01-01", HistoryStore.DOC_TYPE, wid.value(), IndexRequest.OpType.CREATE))).thenReturn(indexResponse);
|
||||
when(clientProxy.index(indexRequest(".watch_history-1970.01.01", HistoryStore.DOC_TYPE, wid.value(), IndexRequest.OpType.CREATE))).thenReturn(indexResponse);
|
||||
historyStore.put(watchRecord);
|
||||
assertThat(watchRecord.version(), equalTo(version));
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ public class HistoryStoreTests extends ElasticsearchTestCase {
|
|||
long version = randomLong();
|
||||
when(indexResponse.getVersion()).thenReturn(version);
|
||||
|
||||
when(clientProxy.index(indexRequest(".watch_history_1970-01-01", HistoryStore.DOC_TYPE, wid.value(), 4L, null))).thenReturn(indexResponse);
|
||||
when(clientProxy.index(indexRequest(".watch_history-1970.01.01", HistoryStore.DOC_TYPE, wid.value(), 4L, null))).thenReturn(indexResponse);
|
||||
historyStore.update(watchRecord);
|
||||
assertThat(watchRecord.version(), equalTo(version));
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ public class HistoryStoreTests extends ElasticsearchTestCase {
|
|||
historyStore.loadRecords(cs, WatchRecord.State.AWAITS_EXECUTION);
|
||||
fail("exception expected, because not all primary shards are started");
|
||||
} catch (HistoryException e) {
|
||||
assertThat(e.getMessage(), containsString("not all primary shards of the [.watch_history_"));
|
||||
assertThat(e.getMessage(), containsString("not all primary shards of the [.watch_history-"));
|
||||
}
|
||||
|
||||
verifyZeroInteractions(templateUtils);
|
||||
|
@ -389,10 +389,10 @@ public class HistoryStoreTests extends ElasticsearchTestCase {
|
|||
|
||||
@Test
|
||||
public void testIndexNameGeneration() {
|
||||
assertThat(HistoryStore.getHistoryIndexNameForTime(new DateTime(0, UTC)), equalTo(".watch_history_1970-01-01"));
|
||||
assertThat(HistoryStore.getHistoryIndexNameForTime(new DateTime(100000000000L, UTC)), equalTo(".watch_history_1973-03-03"));
|
||||
assertThat(HistoryStore.getHistoryIndexNameForTime(new DateTime(1416582852000L, UTC)), equalTo(".watch_history_2014-11-21"));
|
||||
assertThat(HistoryStore.getHistoryIndexNameForTime(new DateTime(2833165811000L, UTC)), equalTo(".watch_history_2059-10-12"));
|
||||
assertThat(HistoryStore.getHistoryIndexNameForTime(new DateTime(0, UTC)), equalTo(".watch_history-1970.01.01"));
|
||||
assertThat(HistoryStore.getHistoryIndexNameForTime(new DateTime(100000000000L, UTC)), equalTo(".watch_history-1973.03.03"));
|
||||
assertThat(HistoryStore.getHistoryIndexNameForTime(new DateTime(1416582852000L, UTC)), equalTo(".watch_history-2014.11.21"));
|
||||
assertThat(HistoryStore.getHistoryIndexNameForTime(new DateTime(2833165811000L, UTC)), equalTo(".watch_history-2059.10.12"));
|
||||
}
|
||||
|
||||
private RefreshResponse mockRefreshResponse(int total, int successful) {
|
||||
|
|
Loading…
Reference in New Issue