use of org.opensearch.action.fieldcaps.FieldCapabilitiesResponse in project OpenSearch by opensearch-project.
the class FieldCapabilitiesIT method testWithUnmapped.
public void testWithUnmapped() {
FieldCapabilitiesResponse response = client().prepareFieldCaps().setFields("new_field", "old_field").setIncludeUnmapped(true).get();
assertIndices(response, "old_index", "new_index");
assertEquals(2, response.get().size());
assertTrue(response.get().containsKey("old_field"));
Map<String, FieldCapabilities> oldField = response.getField("old_field");
assertEquals(2, oldField.size());
assertTrue(oldField.containsKey("long"));
assertEquals(new FieldCapabilities("old_field", "long", true, true, new String[] { "old_index" }, null, null, Collections.emptyMap()), oldField.get("long"));
assertTrue(oldField.containsKey("unmapped"));
assertEquals(new FieldCapabilities("old_field", "unmapped", false, false, new String[] { "new_index" }, null, null, Collections.emptyMap()), oldField.get("unmapped"));
Map<String, FieldCapabilities> newField = response.getField("new_field");
assertEquals(1, newField.size());
assertTrue(newField.containsKey("long"));
assertEquals(new FieldCapabilities("new_field", "long", true, true, null, null, null, Collections.emptyMap()), newField.get("long"));
}
Aggregations