[Rollup] Document type should be _doc (elastic/x-pack-elasticsearch#4363)
Rollup was using a historical `rollup` doc type, when we should be using `_doc` so that it is forward-compatible with the removal in 8.0 Original commit: elastic/x-pack-elasticsearch@4b3188e6c8
This commit is contained in:
parent
31b118552f
commit
b73c16287b
|
@ -435,7 +435,7 @@ setups['sensor_rollup_job'] = '''
|
|||
number_of_shards: 1
|
||||
number_of_replicas: 0
|
||||
mappings:
|
||||
metric:
|
||||
_doc:
|
||||
properties:
|
||||
timestamp:
|
||||
type: date
|
||||
|
@ -485,7 +485,7 @@ setups['sensor_started_rollup_job'] = '''
|
|||
number_of_shards: 1
|
||||
number_of_replicas: 0
|
||||
mappings:
|
||||
data:
|
||||
_doc:
|
||||
properties:
|
||||
timestamp:
|
||||
type: date
|
||||
|
@ -499,7 +499,7 @@ setups['sensor_started_rollup_job'] = '''
|
|||
- do:
|
||||
bulk:
|
||||
index: sensor-1
|
||||
type: data
|
||||
type: _doc
|
||||
refresh: true
|
||||
body: |
|
||||
{"index":{}}
|
||||
|
@ -559,7 +559,7 @@ setups['sensor_index'] = '''
|
|||
number_of_shards: 1
|
||||
number_of_replicas: 0
|
||||
mappings:
|
||||
data:
|
||||
_doc:
|
||||
properties:
|
||||
timestamp:
|
||||
type: date
|
||||
|
@ -590,7 +590,7 @@ setups['sensor_prefab_data'] = '''
|
|||
number_of_shards: 1
|
||||
number_of_replicas: 0
|
||||
mappings:
|
||||
data:
|
||||
_doc:
|
||||
properties:
|
||||
timestamp:
|
||||
type: date
|
||||
|
@ -608,7 +608,7 @@ setups['sensor_prefab_data'] = '''
|
|||
number_of_shards: 1
|
||||
number_of_replicas: 0
|
||||
mappings:
|
||||
rollup:
|
||||
_doc:
|
||||
properties:
|
||||
node.terms.value:
|
||||
type: keyword
|
||||
|
@ -665,7 +665,7 @@ setups['sensor_prefab_data'] = '''
|
|||
- do:
|
||||
bulk:
|
||||
index: sensor_rollup
|
||||
type: rollup
|
||||
type: _doc
|
||||
refresh: true
|
||||
body: |
|
||||
{"index":{}}
|
||||
|
|
|
@ -28,6 +28,7 @@ public class RollupField {
|
|||
public static final String TIMESTAMP = "timestamp";
|
||||
public static final String FILTER = "filter";
|
||||
public static final String NAME = "rollup";
|
||||
public static final String TYPE_NAME = "_doc";
|
||||
public static final String AGG = "agg";
|
||||
public static final String ROLLUP_MISSING = "ROLLUP_MISSING_40710B25931745D4B0B8B310F6912A69";
|
||||
public static final List<String> SUPPORTED_METRICS = Arrays.asList(MaxAggregationBuilder.NAME, MinAggregationBuilder.NAME,
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
"rollup": {
|
||||
"_meta":{
|
||||
"_rollup": {
|
||||
"ROLLUP_METADATA_PLACEHOLDER":"ROLLUP_METADATA_PLACEHOLDER"
|
||||
|
@ -24,5 +23,4 @@
|
|||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -33,7 +33,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
public class RollupIndexCaps implements Writeable, ToXContentFragment {
|
||||
static ParseField ROLLUP_JOBS = new ParseField("rollup_jobs");
|
||||
private static ParseField INDEX_NAME = new ParseField(RollupField.NAME);
|
||||
private static ParseField INDEX_NAME = new ParseField(RollupField.TYPE_NAME);
|
||||
|
||||
//TODO find a way to make this parsing less hacky :(
|
||||
// Note: we ignore unknown fields since there may be unrelated metadata
|
||||
|
@ -43,7 +43,7 @@ public class RollupIndexCaps implements Writeable, ToXContentFragment {
|
|||
/*
|
||||
Rollup index metadata layout is:
|
||||
|
||||
"rollup": {
|
||||
"_doc": {
|
||||
"_meta" : {
|
||||
"_rollup": {
|
||||
"job-1": {
|
||||
|
@ -58,8 +58,8 @@ public class RollupIndexCaps implements Writeable, ToXContentFragment {
|
|||
}
|
||||
*/
|
||||
METADATA_PARSER.declareField((parser, rollupIndexCaps, aVoid) -> {
|
||||
// "rollup"
|
||||
if (parser.currentName().equals(RollupField.NAME) && parser.currentToken().equals(XContentParser.Token.START_OBJECT)) {
|
||||
// "_doc"
|
||||
if (parser.currentName().equals(RollupField.TYPE_NAME) && parser.currentToken().equals(XContentParser.Token.START_OBJECT)) {
|
||||
parser.nextToken();// START_OBJECT
|
||||
List<RollupJobConfig> jobs = new ArrayList<>();
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ public class TransportGetRollupCapsAction extends HandledTransportAction<GetRoll
|
|||
return Optional.empty();
|
||||
}
|
||||
|
||||
MappingMetaData rollupMapping = indexMetaData.getMappings().get(RollupField.NAME);
|
||||
MappingMetaData rollupMapping = indexMetaData.getMappings().get(RollupField.TYPE_NAME);
|
||||
if (rollupMapping == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ public class TransportPutRollupJobAction extends TransportMasterNodeAction<PutRo
|
|||
.replace(Rollup.MAPPING_METADATA_PLACEHOLDER, jobMetadata);
|
||||
|
||||
CreateIndexRequest request = new CreateIndexRequest(job.getConfig().getRollupIndex());
|
||||
request.mapping(RollupField.NAME, mapping, XContentType.JSON);
|
||||
request.mapping(RollupField.TYPE_NAME, mapping, XContentType.JSON);
|
||||
|
||||
client.execute(CreateIndexAction.INSTANCE, request,
|
||||
ActionListener.wrap(createIndexResponse -> startPersistentTask(job, listener, persistentTasksService), e -> {
|
||||
|
@ -154,7 +154,7 @@ public class TransportPutRollupJobAction extends TransportMasterNodeAction<PutRo
|
|||
final String indexName = job.getConfig().getRollupIndex();
|
||||
|
||||
CheckedConsumer<GetMappingsResponse, Exception> getMappingResponseHandler = getMappingResponse -> {
|
||||
MappingMetaData mappings = getMappingResponse.getMappings().get(indexName).get(RollupField.NAME);
|
||||
MappingMetaData mappings = getMappingResponse.getMappings().get(indexName).get(RollupField.TYPE_NAME);
|
||||
Object m = mappings.getSourceAsMap().get("_meta");
|
||||
if (m == null) {
|
||||
String msg = "Expected to find _meta key in mapping of rollup index [" + indexName + "] but not found.";
|
||||
|
@ -186,7 +186,7 @@ public class TransportPutRollupJobAction extends TransportMasterNodeAction<PutRo
|
|||
Map<String, Object> newMapping = mappings.getSourceAsMap();
|
||||
newMapping.put("_meta", metadata);
|
||||
PutMappingRequest request = new PutMappingRequest(indexName);
|
||||
request.type(RollupField.NAME);
|
||||
request.type(RollupField.TYPE_NAME);
|
||||
request.source(newMapping);
|
||||
client.execute(PutMappingAction.INSTANCE, request,
|
||||
ActionListener.wrap(putMappingResponse -> startPersistentTask(job, listener, persistentTasksService),
|
||||
|
|
|
@ -68,8 +68,7 @@ class IndexerUtils {
|
|||
doc.put(RollupField.ROLLUP_META + "." + RollupField.VERSION_FIELD, Rollup.ROLLUP_VERSION);
|
||||
doc.put(RollupField.ROLLUP_META + "." + RollupField.ID.getPreferredName(), jobId);
|
||||
|
||||
IndexRequest request = new IndexRequest(rollupIndex,
|
||||
RollupField.NAME, String.valueOf(docId.getValue()));
|
||||
IndexRequest request = new IndexRequest(rollupIndex, RollupField.TYPE_NAME, String.valueOf(docId.getValue()));
|
||||
request.source(doc);
|
||||
return request;
|
||||
}).collect(Collectors.toList());
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.elasticsearch.analysis.common.CommonAnalysisPlugin;
|
|||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.index.query.MatchAllQueryBuilder;
|
||||
import org.elasticsearch.license.LicenseService;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.search.aggregations.Aggregation;
|
||||
|
@ -460,6 +461,14 @@ public class RollupIT extends ESIntegTestCase {
|
|||
Assert.assertThat(rollupAgg.getType(), equalTo(agg.getType()));
|
||||
verifyAgg((InternalDateHistogram)agg, (InternalDateHistogram)rollupAgg);
|
||||
}
|
||||
|
||||
// And a quick sanity check for doc type
|
||||
SearchRequest rollupRawRequest = new SearchRequest("rolled")
|
||||
.source(new SearchSourceBuilder().query(new MatchAllQueryBuilder())
|
||||
.size(1));
|
||||
SearchResponse searchRawResponse = client().execute(SearchAction.INSTANCE, rollupRawRequest).get();
|
||||
Assert.assertNotNull(searchRawResponse);
|
||||
assertThat(searchRawResponse.getHits().getAt(0).getType(), equalTo("_doc"));
|
||||
}
|
||||
|
||||
private void verifyAgg(InternalDateHistogram verify, InternalDateHistogram rollup) {
|
||||
|
|
|
@ -91,14 +91,14 @@ public class GetRollupCapsActionRequestTests extends AbstractStreamableTestCase<
|
|||
String jobName = randomAlphaOfLength(5);
|
||||
RollupJobConfig job = ConfigTestHelpers.getRollupJob(jobName).build();
|
||||
|
||||
MappingMetaData mappingMeta = new MappingMetaData(RollupField.NAME,
|
||||
Collections.singletonMap(RollupField.NAME,
|
||||
MappingMetaData mappingMeta = new MappingMetaData(RollupField.TYPE_NAME,
|
||||
Collections.singletonMap(RollupField.TYPE_NAME,
|
||||
Collections.singletonMap("_meta",
|
||||
Collections.singletonMap(RollupField.ROLLUP_META,
|
||||
Collections.singletonMap(jobName, job)))));
|
||||
|
||||
ImmutableOpenMap.Builder<String, MappingMetaData> mappings = ImmutableOpenMap.builder(1);
|
||||
mappings.put(RollupField.NAME, mappingMeta);
|
||||
mappings.put(RollupField.TYPE_NAME, mappingMeta);
|
||||
IndexMetaData meta = Mockito.mock(IndexMetaData.class);
|
||||
Mockito.when(meta.getMappings()).thenReturn(mappings.build());
|
||||
Optional<RollupIndexCaps> caps = TransportGetRollupCapsAction.findRollupIndexCaps(indexPattern, meta);
|
||||
|
@ -116,13 +116,13 @@ public class GetRollupCapsActionRequestTests extends AbstractStreamableTestCase<
|
|||
jobs.put(jobName, ConfigTestHelpers.getRollupJob(jobName).build());
|
||||
}
|
||||
|
||||
MappingMetaData mappingMeta = new MappingMetaData(RollupField.NAME,
|
||||
Collections.singletonMap(RollupField.NAME,
|
||||
MappingMetaData mappingMeta = new MappingMetaData(RollupField.TYPE_NAME,
|
||||
Collections.singletonMap(RollupField.TYPE_NAME,
|
||||
Collections.singletonMap("_meta",
|
||||
Collections.singletonMap(RollupField.ROLLUP_META, jobs))));
|
||||
|
||||
ImmutableOpenMap.Builder<String, MappingMetaData> mappings = ImmutableOpenMap.builder(1);
|
||||
mappings.put(RollupField.NAME, mappingMeta);
|
||||
mappings.put(RollupField.TYPE_NAME, mappingMeta);
|
||||
IndexMetaData meta = Mockito.mock(IndexMetaData.class);
|
||||
Mockito.when(meta.getMappings()).thenReturn(mappings.build());
|
||||
Optional<RollupIndexCaps> caps = TransportGetRollupCapsAction.findRollupIndexCaps(indexPattern, meta);
|
||||
|
@ -150,13 +150,13 @@ public class GetRollupCapsActionRequestTests extends AbstractStreamableTestCase<
|
|||
jobs.put(jobName, ConfigTestHelpers.getRollupJob(jobName).setIndexPattern(indexName).build());
|
||||
}
|
||||
|
||||
MappingMetaData mappingMeta = new MappingMetaData(RollupField.NAME,
|
||||
Collections.singletonMap(RollupField.NAME,
|
||||
MappingMetaData mappingMeta = new MappingMetaData(RollupField.TYPE_NAME,
|
||||
Collections.singletonMap(RollupField.TYPE_NAME,
|
||||
Collections.singletonMap("_meta",
|
||||
Collections.singletonMap(RollupField.ROLLUP_META, jobs))));
|
||||
|
||||
ImmutableOpenMap.Builder<String, MappingMetaData> mappings = ImmutableOpenMap.builder(1);
|
||||
mappings.put(RollupField.NAME, mappingMeta);
|
||||
mappings.put(RollupField.TYPE_NAME, mappingMeta);
|
||||
IndexMetaData meta = Mockito.mock(IndexMetaData.class);
|
||||
Mockito.when(meta.getMappings()).thenReturn(mappings.build());
|
||||
indices.put(randomAlphaOfLength(10), meta);
|
||||
|
@ -182,13 +182,13 @@ public class GetRollupCapsActionRequestTests extends AbstractStreamableTestCase<
|
|||
jobs.put(jobName, ConfigTestHelpers.getRollupJob(jobName).setIndexPattern(indexName).build());
|
||||
}
|
||||
|
||||
MappingMetaData mappingMeta = new MappingMetaData(RollupField.NAME,
|
||||
Collections.singletonMap(RollupField.NAME,
|
||||
MappingMetaData mappingMeta = new MappingMetaData(RollupField.TYPE_NAME,
|
||||
Collections.singletonMap(RollupField.TYPE_NAME,
|
||||
Collections.singletonMap("_meta",
|
||||
Collections.singletonMap(RollupField.ROLLUP_META, jobs))));
|
||||
|
||||
ImmutableOpenMap.Builder<String, MappingMetaData> mappings = ImmutableOpenMap.builder(1);
|
||||
mappings.put(RollupField.NAME, mappingMeta);
|
||||
mappings.put(RollupField.TYPE_NAME, mappingMeta);
|
||||
IndexMetaData meta = Mockito.mock(IndexMetaData.class);
|
||||
Mockito.when(meta.getMappings()).thenReturn(mappings.build());
|
||||
|
||||
|
|
|
@ -120,8 +120,8 @@ public class PutJobStateMachineTests extends ESTestCase {
|
|||
ArgumentCaptor<ActionListener> listenerCaptor = ArgumentCaptor.forClass(ActionListener.class);
|
||||
ArgumentCaptor<CreateIndexRequest> requestCaptor = ArgumentCaptor.forClass(CreateIndexRequest.class);
|
||||
doAnswer(invocation -> {
|
||||
assertNotNull(requestCaptor.getValue().mappings().get("rollup"));
|
||||
String mapping = requestCaptor.getValue().mappings().get("rollup");
|
||||
assertNotNull(requestCaptor.getValue().mappings().get("_doc"));
|
||||
String mapping = requestCaptor.getValue().mappings().get("_doc");
|
||||
|
||||
// Make sure the version is present, and we have our date template (the most important aspects)
|
||||
assertThat(mapping, containsString("\"rollup-version\": \"" + Version.CURRENT.toString() + "\""));
|
||||
|
@ -187,9 +187,9 @@ public class PutJobStateMachineTests extends ESTestCase {
|
|||
ArgumentCaptor<ActionListener> requestCaptor = ArgumentCaptor.forClass(ActionListener.class);
|
||||
doAnswer(invocation -> {
|
||||
GetMappingsResponse response = mock(GetMappingsResponse.class);
|
||||
MappingMetaData meta = new MappingMetaData(RollupField.NAME, Collections.emptyMap());
|
||||
MappingMetaData meta = new MappingMetaData(RollupField.TYPE_NAME, Collections.emptyMap());
|
||||
ImmutableOpenMap.Builder<String, MappingMetaData> builder = ImmutableOpenMap.builder(1);
|
||||
builder.put(RollupField.NAME, meta);
|
||||
builder.put(RollupField.TYPE_NAME, meta);
|
||||
|
||||
ImmutableOpenMap.Builder<String, ImmutableOpenMap<String, MappingMetaData>> builder2 = ImmutableOpenMap.builder(1);
|
||||
builder2.put(job.getConfig().getRollupIndex(), builder.build());
|
||||
|
@ -219,12 +219,12 @@ public class PutJobStateMachineTests extends ESTestCase {
|
|||
ArgumentCaptor<ActionListener> requestCaptor = ArgumentCaptor.forClass(ActionListener.class);
|
||||
doAnswer(invocation -> {
|
||||
GetMappingsResponse response = mock(GetMappingsResponse.class);
|
||||
MappingMetaData meta = new MappingMetaData(RollupField.NAME,
|
||||
MappingMetaData meta = new MappingMetaData(RollupField.TYPE_NAME,
|
||||
Collections.singletonMap("_meta",
|
||||
Collections.singletonMap(RollupField.ROLLUP_META,
|
||||
Collections.singletonMap(job.getConfig().getId(), job.getConfig()))));
|
||||
ImmutableOpenMap.Builder<String, MappingMetaData> builder = ImmutableOpenMap.builder(1);
|
||||
builder.put(RollupField.NAME, meta);
|
||||
builder.put(RollupField.TYPE_NAME, meta);
|
||||
|
||||
ImmutableOpenMap.Builder<String, ImmutableOpenMap<String, MappingMetaData>> builder2 = ImmutableOpenMap.builder(1);
|
||||
builder2.put(job.getConfig().getRollupIndex(), builder.build());
|
||||
|
@ -258,11 +258,11 @@ public class PutJobStateMachineTests extends ESTestCase {
|
|||
ArgumentCaptor<ActionListener> requestCaptor = ArgumentCaptor.forClass(ActionListener.class);
|
||||
doAnswer(invocation -> {
|
||||
GetMappingsResponse response = mock(GetMappingsResponse.class);
|
||||
MappingMetaData meta = new MappingMetaData(RollupField.NAME,
|
||||
MappingMetaData meta = new MappingMetaData(RollupField.TYPE_NAME,
|
||||
Collections.singletonMap("_meta", Collections.singletonMap(RollupField.ROLLUP_META,
|
||||
Collections.singletonMap(unrelatedJob.getId(), unrelatedJob))));
|
||||
ImmutableOpenMap.Builder<String, MappingMetaData> builder = ImmutableOpenMap.builder(1);
|
||||
builder.put(RollupField.NAME, meta);
|
||||
builder.put(RollupField.TYPE_NAME, meta);
|
||||
|
||||
ImmutableOpenMap.Builder<String, ImmutableOpenMap<String, MappingMetaData>> builder2 = ImmutableOpenMap.builder(1);
|
||||
builder2.put(unrelatedJob.getRollupIndex(), builder.build());
|
||||
|
|
|
@ -563,14 +563,14 @@ public class SearchActionTests extends ESTestCase {
|
|||
String jobName = randomAlphaOfLength(5);
|
||||
RollupJobConfig job = ConfigTestHelpers.getRollupJob(jobName).build();
|
||||
|
||||
MappingMetaData mappingMeta = new MappingMetaData(RollupField.NAME,
|
||||
Collections.singletonMap(RollupField.NAME,
|
||||
MappingMetaData mappingMeta = new MappingMetaData(RollupField.TYPE_NAME,
|
||||
Collections.singletonMap(RollupField.TYPE_NAME,
|
||||
Collections.singletonMap("_meta",
|
||||
Collections.singletonMap(RollupField.ROLLUP_META,
|
||||
Collections.singletonMap(jobName, job)))));
|
||||
|
||||
ImmutableOpenMap.Builder<String, MappingMetaData> mappings = ImmutableOpenMap.builder(1);
|
||||
mappings.put(RollupField.NAME, mappingMeta);
|
||||
mappings.put(RollupField.TYPE_NAME, mappingMeta);
|
||||
IndexMetaData meta = Mockito.mock(IndexMetaData.class);
|
||||
when(meta.getMappings()).thenReturn(mappings.build());
|
||||
|
||||
|
@ -607,14 +607,14 @@ public class SearchActionTests extends ESTestCase {
|
|||
String jobName = randomAlphaOfLength(5);
|
||||
RollupJobConfig job = ConfigTestHelpers.getRollupJob(jobName).build();
|
||||
|
||||
MappingMetaData mappingMeta = new MappingMetaData(RollupField.NAME,
|
||||
Collections.singletonMap(RollupField.NAME,
|
||||
MappingMetaData mappingMeta = new MappingMetaData(RollupField.TYPE_NAME,
|
||||
Collections.singletonMap(RollupField.TYPE_NAME,
|
||||
Collections.singletonMap("_meta",
|
||||
Collections.singletonMap(RollupField.ROLLUP_META,
|
||||
Collections.singletonMap(jobName, job)))));
|
||||
|
||||
ImmutableOpenMap.Builder<String, MappingMetaData> mappings = ImmutableOpenMap.builder(1);
|
||||
mappings.put(RollupField.NAME, mappingMeta);
|
||||
mappings.put(RollupField.TYPE_NAME, mappingMeta);
|
||||
IndexMetaData indexMeta = Mockito.mock(IndexMetaData.class);
|
||||
when(indexMeta.getMappings()).thenReturn(mappings.build());
|
||||
|
||||
|
@ -671,14 +671,14 @@ public class SearchActionTests extends ESTestCase {
|
|||
String jobName = randomAlphaOfLength(5);
|
||||
RollupJobConfig job = ConfigTestHelpers.getRollupJob(jobName).build();
|
||||
|
||||
MappingMetaData mappingMeta = new MappingMetaData(RollupField.NAME,
|
||||
Collections.singletonMap(RollupField.NAME,
|
||||
MappingMetaData mappingMeta = new MappingMetaData(RollupField.TYPE_NAME,
|
||||
Collections.singletonMap(RollupField.TYPE_NAME,
|
||||
Collections.singletonMap("_meta",
|
||||
Collections.singletonMap(RollupField.ROLLUP_META,
|
||||
Collections.singletonMap(jobName, job)))));
|
||||
|
||||
ImmutableOpenMap.Builder<String, MappingMetaData> mappings = ImmutableOpenMap.builder(1);
|
||||
mappings.put(RollupField.NAME, mappingMeta);
|
||||
mappings.put(RollupField.TYPE_NAME, mappingMeta);
|
||||
IndexMetaData indexMeta = Mockito.mock(IndexMetaData.class);
|
||||
when(indexMeta.getMappings()).thenReturn(mappings.build());
|
||||
|
||||
|
@ -706,14 +706,14 @@ public class SearchActionTests extends ESTestCase {
|
|||
String jobName = randomAlphaOfLength(5);
|
||||
RollupJobConfig job = ConfigTestHelpers.getRollupJob(jobName).build();
|
||||
|
||||
MappingMetaData mappingMeta = new MappingMetaData(RollupField.NAME,
|
||||
Collections.singletonMap(RollupField.NAME,
|
||||
MappingMetaData mappingMeta = new MappingMetaData(RollupField.TYPE_NAME,
|
||||
Collections.singletonMap(RollupField.TYPE_NAME,
|
||||
Collections.singletonMap("_meta",
|
||||
Collections.singletonMap(RollupField.ROLLUP_META,
|
||||
Collections.singletonMap(jobName, job)))));
|
||||
|
||||
ImmutableOpenMap.Builder<String, MappingMetaData> mappings = ImmutableOpenMap.builder(1);
|
||||
mappings.put(RollupField.NAME, mappingMeta);
|
||||
mappings.put(RollupField.TYPE_NAME, mappingMeta);
|
||||
IndexMetaData indexMeta = Mockito.mock(IndexMetaData.class);
|
||||
when(indexMeta.getMappings()).thenReturn(mappings.build());
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ public class RollupIndexerIndexingTests extends AggregatorTestCase {
|
|||
assertThat(resp.size(), equalTo(2));
|
||||
IndexRequest request = resp.get(0);
|
||||
assertThat(request.index(), equalTo(rollupIndex));
|
||||
assertThat(request.type(), equalTo("rollup"));
|
||||
assertThat(request.type(), equalTo("_doc"));
|
||||
assertThat(request.sourceAsMap(), equalTo(
|
||||
asMap(
|
||||
"_rollup.version", 1,
|
||||
|
@ -121,7 +121,7 @@ public class RollupIndexerIndexingTests extends AggregatorTestCase {
|
|||
));
|
||||
request = resp.get(1);
|
||||
assertThat(request.index(), equalTo(rollupIndex));
|
||||
assertThat(request.type(), equalTo("rollup"));
|
||||
assertThat(request.type(), equalTo("_doc"));
|
||||
assertThat(request.sourceAsMap(), equalTo(
|
||||
asMap(
|
||||
"_rollup.version", 1,
|
||||
|
@ -169,7 +169,7 @@ public class RollupIndexerIndexingTests extends AggregatorTestCase {
|
|||
assertThat(resp.size(), equalTo(5));
|
||||
IndexRequest request = resp.get(0);
|
||||
assertThat(request.index(), equalTo(rollupIndex));
|
||||
assertThat(request.type(), equalTo("rollup"));
|
||||
assertThat(request.type(), equalTo("_doc"));
|
||||
assertThat(request.sourceAsMap(), equalTo(
|
||||
asMap(
|
||||
"_rollup.version", 1,
|
||||
|
@ -187,7 +187,7 @@ public class RollupIndexerIndexingTests extends AggregatorTestCase {
|
|||
));
|
||||
request = resp.get(1);
|
||||
assertThat(request.index(), equalTo(rollupIndex));
|
||||
assertThat(request.type(), equalTo("rollup"));
|
||||
assertThat(request.type(), equalTo("_doc"));
|
||||
assertThat(request.sourceAsMap(), equalTo(
|
||||
asMap(
|
||||
"_rollup.version", 1,
|
||||
|
@ -205,7 +205,7 @@ public class RollupIndexerIndexingTests extends AggregatorTestCase {
|
|||
));
|
||||
request = resp.get(2);
|
||||
assertThat(request.index(), equalTo(rollupIndex));
|
||||
assertThat(request.type(), equalTo("rollup"));
|
||||
assertThat(request.type(), equalTo("_doc"));
|
||||
assertThat(request.sourceAsMap(), equalTo(
|
||||
asMap(
|
||||
"_rollup.version", 1,
|
||||
|
@ -223,7 +223,7 @@ public class RollupIndexerIndexingTests extends AggregatorTestCase {
|
|||
));
|
||||
request = resp.get(3);
|
||||
assertThat(request.index(), equalTo(rollupIndex));
|
||||
assertThat(request.type(), equalTo("rollup"));
|
||||
assertThat(request.type(), equalTo("_doc"));
|
||||
assertThat(request.sourceAsMap(), equalTo(
|
||||
asMap(
|
||||
"_rollup.version", 1,
|
||||
|
@ -241,7 +241,7 @@ public class RollupIndexerIndexingTests extends AggregatorTestCase {
|
|||
));
|
||||
request = resp.get(4);
|
||||
assertThat(request.index(), equalTo(rollupIndex));
|
||||
assertThat(request.type(), equalTo("rollup"));
|
||||
assertThat(request.type(), equalTo("_doc"));
|
||||
assertThat(request.sourceAsMap(), equalTo(
|
||||
asMap(
|
||||
"_rollup.version", 1,
|
||||
|
@ -290,7 +290,7 @@ public class RollupIndexerIndexingTests extends AggregatorTestCase {
|
|||
assertThat(resp.size(), equalTo(3));
|
||||
IndexRequest request = resp.get(0);
|
||||
assertThat(request.index(), equalTo(rollupIndex));
|
||||
assertThat(request.type(), equalTo("rollup"));
|
||||
assertThat(request.type(), equalTo("_doc"));
|
||||
assertThat(request.sourceAsMap(), equalTo(
|
||||
asMap(
|
||||
"_rollup.version", 1,
|
||||
|
@ -303,7 +303,7 @@ public class RollupIndexerIndexingTests extends AggregatorTestCase {
|
|||
));
|
||||
request = resp.get(1);
|
||||
assertThat(request.index(), equalTo(rollupIndex));
|
||||
assertThat(request.type(), equalTo("rollup"));
|
||||
assertThat(request.type(), equalTo("_doc"));
|
||||
assertThat(request.sourceAsMap(), equalTo(
|
||||
asMap(
|
||||
"_rollup.version", 1,
|
||||
|
@ -316,7 +316,7 @@ public class RollupIndexerIndexingTests extends AggregatorTestCase {
|
|||
));
|
||||
request = resp.get(2);
|
||||
assertThat(request.index(), equalTo(rollupIndex));
|
||||
assertThat(request.type(), equalTo("rollup"));
|
||||
assertThat(request.type(), equalTo("_doc"));
|
||||
assertThat(request.sourceAsMap(), equalTo(
|
||||
asMap(
|
||||
"_rollup.version", 1,
|
||||
|
@ -359,7 +359,7 @@ public class RollupIndexerIndexingTests extends AggregatorTestCase {
|
|||
assertThat(resp.size(), equalTo(1));
|
||||
IndexRequest request = resp.get(0);
|
||||
assertThat(request.index(), equalTo(rollupIndex));
|
||||
assertThat(request.type(), equalTo("rollup"));
|
||||
assertThat(request.type(), equalTo("_doc"));
|
||||
assertThat(request.sourceAsMap(), equalTo(
|
||||
asMap(
|
||||
"_rollup.version", 1,
|
||||
|
@ -378,7 +378,7 @@ public class RollupIndexerIndexingTests extends AggregatorTestCase {
|
|||
assertThat(resp.size(), equalTo(2));
|
||||
IndexRequest request = resp.get(0);
|
||||
assertThat(request.index(), equalTo(rollupIndex));
|
||||
assertThat(request.type(), equalTo("rollup"));
|
||||
assertThat(request.type(), equalTo("_doc"));
|
||||
assertThat(request.sourceAsMap(), equalTo(
|
||||
asMap(
|
||||
"_rollup.version", 1,
|
||||
|
@ -391,7 +391,7 @@ public class RollupIndexerIndexingTests extends AggregatorTestCase {
|
|||
));
|
||||
request = resp.get(1);
|
||||
assertThat(request.index(), equalTo(rollupIndex));
|
||||
assertThat(request.type(), equalTo("rollup"));
|
||||
assertThat(request.type(), equalTo("_doc"));
|
||||
assertThat(request.sourceAsMap(), equalTo(
|
||||
asMap(
|
||||
"_rollup.version", 1,
|
||||
|
@ -429,7 +429,7 @@ public class RollupIndexerIndexingTests extends AggregatorTestCase {
|
|||
assertThat(resp.size(), greaterThan(0));
|
||||
for (DocWriteRequest request : resp) {
|
||||
assertThat(request.index(), equalTo(rollupIndex));
|
||||
assertThat(request.type(), equalTo("rollup"));
|
||||
assertThat(request.type(), equalTo("_doc"));
|
||||
|
||||
Map<String, Object> source = ((IndexRequest) request).sourceAsMap();
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ setup:
|
|||
index: foo
|
||||
body:
|
||||
mappings:
|
||||
doc:
|
||||
_doc:
|
||||
properties:
|
||||
the_field:
|
||||
type: date
|
||||
|
|
|
@ -4,7 +4,7 @@ setup:
|
|||
index: foo
|
||||
body:
|
||||
mappings:
|
||||
doc:
|
||||
_doc:
|
||||
properties:
|
||||
the_field:
|
||||
type: date
|
||||
|
|
|
@ -2,9 +2,9 @@ setup:
|
|||
- do:
|
||||
indices.create:
|
||||
index: foo
|
||||
include_type_name: false
|
||||
body:
|
||||
mappings:
|
||||
doc:
|
||||
properties:
|
||||
the_field:
|
||||
type: date
|
||||
|
@ -14,9 +14,9 @@ setup:
|
|||
- do:
|
||||
indices.create:
|
||||
index: foo2
|
||||
include_type_name: false
|
||||
body:
|
||||
mappings:
|
||||
doc:
|
||||
properties:
|
||||
the_field:
|
||||
type: date
|
||||
|
|
|
@ -4,7 +4,7 @@ setup:
|
|||
index: foo
|
||||
body:
|
||||
mappings:
|
||||
doc:
|
||||
_doc:
|
||||
properties:
|
||||
the_field:
|
||||
type: date
|
||||
|
|
|
@ -4,7 +4,7 @@ setup:
|
|||
index: foo
|
||||
body:
|
||||
mappings:
|
||||
doc:
|
||||
_doc:
|
||||
properties:
|
||||
timestamp:
|
||||
type: date
|
||||
|
@ -49,7 +49,7 @@ setup:
|
|||
body:
|
||||
- index:
|
||||
_index: "foo_rollup"
|
||||
_type: "rollup"
|
||||
_type: "_doc"
|
||||
- timestamp.date_histogram.timestamp: "2017-01-01T05:00:00Z"
|
||||
timestamp.date_histogram.interval: "1h"
|
||||
timestamp.date_histogram.time_zone: "UTC"
|
||||
|
@ -65,7 +65,7 @@ setup:
|
|||
|
||||
- index:
|
||||
_index: "foo_rollup"
|
||||
_type: "rollup"
|
||||
_type: "_doc"
|
||||
- timestamp.date_histogram.timestamp: "2017-01-01T06:00:00Z"
|
||||
timestamp.date_histogram.interval: "1h"
|
||||
timestamp.date_histogram.time_zone: "UTC"
|
||||
|
@ -81,7 +81,7 @@ setup:
|
|||
|
||||
- index:
|
||||
_index: "foo_rollup"
|
||||
_type: "rollup"
|
||||
_type: "_doc"
|
||||
- timestamp.date_histogram.timestamp: "2017-01-01T07:00:00Z"
|
||||
timestamp.date_histogram.interval: "1h"
|
||||
timestamp.date_histogram.time_zone: "UTC"
|
||||
|
@ -97,7 +97,7 @@ setup:
|
|||
|
||||
- index:
|
||||
_index: "foo_rollup"
|
||||
_type: "rollup"
|
||||
_type: "_doc"
|
||||
- timestamp.date_histogram.timestamp: "2017-01-01T08:00:00Z"
|
||||
timestamp.date_histogram.interval: "1h"
|
||||
timestamp.date_histogram.time_zone: "UTC"
|
||||
|
@ -113,7 +113,7 @@ setup:
|
|||
|
||||
- index:
|
||||
_index: "foo_rollup"
|
||||
_type: "rollup"
|
||||
_type: "_doc"
|
||||
- timestamp.date_histogram.timestamp: "2017-01-01T08:00:00Z"
|
||||
timestamp.date_histogram.interval: "1h"
|
||||
timestamp.date_histogram.time_zone: "UTC"
|
||||
|
@ -260,7 +260,7 @@ setup:
|
|||
body:
|
||||
- index:
|
||||
_index: "foo_rollup"
|
||||
_type: "rollup"
|
||||
_type: "_doc"
|
||||
- timestamp.date_histogram.timestamp: "2017-01-01T05:00:00Z"
|
||||
timestamp.date_histogram.interval: "1h"
|
||||
timestamp.date_histogram.time_zone: "UTC"
|
||||
|
@ -276,7 +276,7 @@ setup:
|
|||
|
||||
- index:
|
||||
_index: "foo_rollup"
|
||||
_type: "rollup"
|
||||
_type: "_doc"
|
||||
- timestamp.date_histogram.timestamp: "2017-01-01T06:00:00Z"
|
||||
timestamp.date_histogram.interval: "1h"
|
||||
timestamp.date_histogram.time_zone: "UTC"
|
||||
|
@ -292,7 +292,7 @@ setup:
|
|||
|
||||
- index:
|
||||
_index: "foo_rollup"
|
||||
_type: "rollup"
|
||||
_type: "_doc"
|
||||
- timestamp.date_histogram.timestamp: "2017-01-01T07:00:00Z"
|
||||
timestamp.date_histogram.interval: "1h"
|
||||
timestamp.date_histogram.time_zone: "UTC"
|
||||
|
@ -308,7 +308,7 @@ setup:
|
|||
|
||||
- index:
|
||||
_index: "foo_rollup"
|
||||
_type: "rollup"
|
||||
_type: "_doc"
|
||||
- timestamp.date_histogram.timestamp: "2017-01-01T08:00:00Z"
|
||||
timestamp.date_histogram.interval: "1h"
|
||||
timestamp.date_histogram.time_zone: "UTC"
|
||||
|
@ -324,7 +324,7 @@ setup:
|
|||
|
||||
- index:
|
||||
_index: "foo_rollup"
|
||||
_type: "rollup"
|
||||
_type: "_doc"
|
||||
- timestamp.date_histogram.timestamp: "2017-01-01T08:00:00Z"
|
||||
timestamp.date_histogram.interval: "1h"
|
||||
timestamp.date_histogram.time_zone: "UTC"
|
||||
|
@ -408,7 +408,7 @@ setup:
|
|||
body:
|
||||
- index:
|
||||
_index: "foo_rollup"
|
||||
_type: "rollup"
|
||||
_type: "_doc"
|
||||
- timestamp.date_histogram.timestamp: "2017-01-01T05:00:00Z"
|
||||
timestamp.date_histogram.interval: "1h"
|
||||
timestamp.date_histogram.time_zone: "UTC"
|
||||
|
@ -424,7 +424,7 @@ setup:
|
|||
|
||||
- index:
|
||||
_index: "foo_rollup"
|
||||
_type: "rollup"
|
||||
_type: "_doc"
|
||||
- timestamp.date_histogram.timestamp: "2017-01-01T06:00:00Z"
|
||||
timestamp.date_histogram.interval: "1h"
|
||||
timestamp.date_histogram.time_zone: "UTC"
|
||||
|
@ -440,7 +440,7 @@ setup:
|
|||
|
||||
- index:
|
||||
_index: "foo_rollup"
|
||||
_type: "rollup"
|
||||
_type: "_doc"
|
||||
- timestamp.date_histogram.timestamp: "2017-01-01T07:00:00Z"
|
||||
timestamp.date_histogram.interval: "1h"
|
||||
timestamp.date_histogram.time_zone: "UTC"
|
||||
|
@ -456,7 +456,7 @@ setup:
|
|||
|
||||
- index:
|
||||
_index: "foo_rollup"
|
||||
_type: "rollup"
|
||||
_type: "_doc"
|
||||
- timestamp.date_histogram.timestamp: "2017-01-01T08:00:00Z"
|
||||
timestamp.date_histogram.interval: "1h"
|
||||
timestamp.date_histogram.time_zone: "UTC"
|
||||
|
@ -472,7 +472,7 @@ setup:
|
|||
|
||||
- index:
|
||||
_index: "foo_rollup"
|
||||
_type: "rollup"
|
||||
_type: "_doc"
|
||||
- timestamp.date_histogram.timestamp: "2017-01-01T08:00:00Z"
|
||||
timestamp.date_histogram.interval: "1h"
|
||||
timestamp.date_histogram.time_zone: "UTC"
|
||||
|
@ -558,7 +558,7 @@ setup:
|
|||
body:
|
||||
- index:
|
||||
_index: "foo_rollup"
|
||||
_type: "rollup"
|
||||
_type: "_doc"
|
||||
- timestamp.date_histogram.timestamp: "2017-01-01T05:00:00Z"
|
||||
timestamp.date_histogram.interval: "1h"
|
||||
timestamp.date_histogram.time_zone: "UTC"
|
||||
|
@ -574,7 +574,7 @@ setup:
|
|||
|
||||
- index:
|
||||
_index: "foo_rollup"
|
||||
_type: "rollup"
|
||||
_type: "_doc"
|
||||
- timestamp.date_histogram.timestamp: "2017-01-01T06:00:00Z"
|
||||
timestamp.date_histogram.interval: "1h"
|
||||
timestamp.date_histogram.time_zone: "UTC"
|
||||
|
@ -590,7 +590,7 @@ setup:
|
|||
|
||||
- index:
|
||||
_index: "foo_rollup"
|
||||
_type: "rollup"
|
||||
_type: "_doc"
|
||||
- timestamp.date_histogram.timestamp: "2017-01-01T07:00:00Z"
|
||||
timestamp.date_histogram.interval: "1h"
|
||||
timestamp.date_histogram.time_zone: "UTC"
|
||||
|
@ -606,7 +606,7 @@ setup:
|
|||
|
||||
- index:
|
||||
_index: "foo_rollup"
|
||||
_type: "rollup"
|
||||
_type: "_doc"
|
||||
- timestamp.date_histogram.timestamp: "2017-01-01T08:00:00Z"
|
||||
timestamp.date_histogram.interval: "1h"
|
||||
timestamp.date_histogram.time_zone: "UTC"
|
||||
|
@ -622,7 +622,7 @@ setup:
|
|||
|
||||
- index:
|
||||
_index: "foo_rollup"
|
||||
_type: "rollup"
|
||||
_type: "_doc"
|
||||
- timestamp.date_histogram.timestamp: "2017-01-01T08:00:00Z"
|
||||
timestamp.date_histogram.interval: "1h"
|
||||
timestamp.date_histogram.time_zone: "UTC"
|
||||
|
|
|
@ -4,7 +4,7 @@ setup:
|
|||
index: foo
|
||||
body:
|
||||
mappings:
|
||||
doc:
|
||||
_doc:
|
||||
properties:
|
||||
the_field:
|
||||
type: date
|
||||
|
|
|
@ -4,7 +4,7 @@ setup:
|
|||
index: foo
|
||||
body:
|
||||
mappings:
|
||||
doc:
|
||||
_doc:
|
||||
properties:
|
||||
the_field:
|
||||
type: date
|
||||
|
|
Loading…
Reference in New Issue