use of org.opensearch.index.mapper.IndexFieldMapper in project OpenSearch by opensearch-project.
the class QueryShardContextTests method testClusterAlias.
public void testClusterAlias() throws IOException {
final String clusterAlias = randomBoolean() ? null : "remote_cluster";
QueryShardContext context = createQueryShardContext(IndexMetadata.INDEX_UUID_NA_VALUE, clusterAlias);
IndexFieldMapper mapper = new IndexFieldMapper();
IndexFieldData<?> forField = context.getForField(mapper.fieldType());
String expected = clusterAlias == null ? context.getIndexSettings().getIndexMetadata().getIndex().getName() : clusterAlias + ":" + context.getIndexSettings().getIndex().getName();
assertEquals(expected, ((AbstractLeafOrdinalsFieldData) forField.load(null)).getOrdinalsValues().lookupOrd(0).utf8ToString());
}
Aggregations