mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-12 18:47:45 +00:00
fix(api): Add preceding / to get index sizes path (#9043)
Co-authored-by: Indy Prentice <indy@Indys-MacBook-Pro.local>
This commit is contained in:
parent
aae1347efc
commit
7855fb60a7
@ -169,7 +169,7 @@ public class ElasticSearchTimeseriesAspectService implements TimeseriesAspectSer
|
||||
List<TimeseriesIndexSizeResult> res = new ArrayList<>();
|
||||
try {
|
||||
String indicesPattern = _indexConvention.getAllTimeseriesAspectIndicesPattern();
|
||||
Response r = _searchClient.getLowLevelClient().performRequest(new Request("GET", indicesPattern + "/_stats"));
|
||||
Response r = _searchClient.getLowLevelClient().performRequest(new Request("GET", "/" + indicesPattern + "/_stats"));
|
||||
JsonNode body = new ObjectMapper().readTree(r.getEntity().getContent());
|
||||
body.get("indices").fields().forEachRemaining(entry -> {
|
||||
TimeseriesIndexSizeResult elemResult = new TimeseriesIndexSizeResult();
|
||||
|
||||
@ -45,6 +45,7 @@ import com.linkedin.timeseries.GenericTable;
|
||||
import com.linkedin.timeseries.GroupingBucket;
|
||||
import com.linkedin.timeseries.GroupingBucketType;
|
||||
import com.linkedin.timeseries.TimeWindowSize;
|
||||
import com.linkedin.timeseries.TimeseriesIndexSizeResult;
|
||||
import org.opensearch.client.RestHighLevelClient;
|
||||
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
@ -884,4 +885,19 @@ abstract public class TimeseriesAspectServiceTestBase extends AbstractTestNGSpri
|
||||
_elasticSearchTimeseriesAspectService.countByFilter(ENTITY_NAME, ASPECT_NAME, urnAndTimeFilter);
|
||||
assertEquals(count, 0L);
|
||||
}
|
||||
|
||||
@Test(groups = {"getAggregatedStats"}, dependsOnGroups = {"upsert"})
|
||||
public void testGetIndexSizes() {
|
||||
List<TimeseriesIndexSizeResult> result = _elasticSearchTimeseriesAspectService.getIndexSizes();
|
||||
/*
|
||||
Example result:
|
||||
{aspectName=testentityprofile, sizeMb=52.234, indexName=es_timeseries_aspect_service_test_testentity_testentityprofileaspect_v1, entityName=testentity}
|
||||
{aspectName=testentityprofile, sizeMb=0.208, indexName=es_timeseries_aspect_service_test_testentitywithouttests_testentityprofileaspect_v1, entityName=testentitywithouttests}
|
||||
*/
|
||||
// There may be other indices in there from other tests, so just make sure that index for entity + aspect is in there
|
||||
assertTrue(result.size() > 1);
|
||||
assertTrue(
|
||||
result.stream().anyMatch(idxSizeResult -> idxSizeResult.getIndexName().equals(
|
||||
"es_timeseries_aspect_service_test_testentitywithouttests_testentityprofileaspect_v1")));
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user