mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-31 04:14:34 +00:00
Fix DataInsights Field Getter (#17427)
This commit is contained in:
parent
2dfd7d1f70
commit
c221f80d15
@ -2010,6 +2010,7 @@ public class ElasticSearchClient implements SearchClient {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, String>> fetchDIChartFields() throws IOException {
|
public List<Map<String, String>> fetchDIChartFields() throws IOException {
|
||||||
|
List<Map<String, String>> fields = new ArrayList<>();
|
||||||
GetMappingsRequest request =
|
GetMappingsRequest request =
|
||||||
new GetMappingsRequest().indices(DataInsightSystemChartRepository.DI_SEARCH_INDEX);
|
new GetMappingsRequest().indices(DataInsightSystemChartRepository.DI_SEARCH_INDEX);
|
||||||
|
|
||||||
@ -2020,11 +2021,9 @@ public class ElasticSearchClient implements SearchClient {
|
|||||||
for (Map.Entry<String, MappingMetadata> entry : response.mappings().entrySet()) {
|
for (Map.Entry<String, MappingMetadata> entry : response.mappings().entrySet()) {
|
||||||
// Get fields for the index
|
// Get fields for the index
|
||||||
Map<String, Object> indexFields = entry.getValue().sourceAsMap();
|
Map<String, Object> indexFields = entry.getValue().sourceAsMap();
|
||||||
List<Map<String, String>> fields = new ArrayList<>();
|
|
||||||
getFieldNames((Map<String, Object>) indexFields.get("properties"), "", fields);
|
getFieldNames((Map<String, Object>) indexFields.get("properties"), "", fields);
|
||||||
return fields;
|
|
||||||
}
|
}
|
||||||
return null;
|
return fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
void getFieldNames(
|
void getFieldNames(
|
||||||
@ -2045,11 +2044,13 @@ public class ElasticSearchClient implements SearchClient {
|
|||||||
getFieldNames(
|
getFieldNames(
|
||||||
(Map<String, Object>) subFields.get("properties"), fieldName + ".", fieldList);
|
(Map<String, Object>) subFields.get("properties"), fieldName + ".", fieldList);
|
||||||
} else {
|
} else {
|
||||||
Map<String, String> map = new HashMap<>();
|
if (fieldList.stream().noneMatch(e -> e.get("name").equals(fieldName))) {
|
||||||
map.put("name", fieldName);
|
Map<String, String> map = new HashMap<>();
|
||||||
map.put("displayName", fieldNameOriginal);
|
map.put("name", fieldName);
|
||||||
map.put("type", type);
|
map.put("displayName", fieldNameOriginal);
|
||||||
fieldList.add(map);
|
map.put("type", type);
|
||||||
|
fieldList.add(map);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1987,6 +1987,7 @@ public class OpenSearchClient implements SearchClient {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, String>> fetchDIChartFields() throws IOException {
|
public List<Map<String, String>> fetchDIChartFields() throws IOException {
|
||||||
|
List<Map<String, String>> fields = new ArrayList<>();
|
||||||
GetMappingsRequest request =
|
GetMappingsRequest request =
|
||||||
new GetMappingsRequest().indices(DataInsightSystemChartRepository.DI_SEARCH_INDEX);
|
new GetMappingsRequest().indices(DataInsightSystemChartRepository.DI_SEARCH_INDEX);
|
||||||
|
|
||||||
@ -1997,11 +1998,9 @@ public class OpenSearchClient implements SearchClient {
|
|||||||
for (Map.Entry<String, MappingMetadata> entry : response.mappings().entrySet()) {
|
for (Map.Entry<String, MappingMetadata> entry : response.mappings().entrySet()) {
|
||||||
// Get fields for the index
|
// Get fields for the index
|
||||||
Map<String, Object> indexFields = entry.getValue().sourceAsMap();
|
Map<String, Object> indexFields = entry.getValue().sourceAsMap();
|
||||||
List<Map<String, String>> fields = new ArrayList<>();
|
|
||||||
getFieldNames((Map<String, Object>) indexFields.get("properties"), "", fields);
|
getFieldNames((Map<String, Object>) indexFields.get("properties"), "", fields);
|
||||||
return fields;
|
|
||||||
}
|
}
|
||||||
return null;
|
return fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
void getFieldNames(
|
void getFieldNames(
|
||||||
@ -2022,11 +2021,13 @@ public class OpenSearchClient implements SearchClient {
|
|||||||
getFieldNames(
|
getFieldNames(
|
||||||
(Map<String, Object>) subFields.get("properties"), fieldName + ".", fieldList);
|
(Map<String, Object>) subFields.get("properties"), fieldName + ".", fieldList);
|
||||||
} else {
|
} else {
|
||||||
Map<String, String> map = new HashMap<>();
|
if (fieldList.stream().noneMatch(e -> e.get("name").equals(fieldName))) {
|
||||||
map.put("name", fieldName);
|
Map<String, String> map = new HashMap<>();
|
||||||
map.put("displayName", fieldNameOriginal);
|
map.put("name", fieldName);
|
||||||
map.put("type", type);
|
map.put("displayName", fieldNameOriginal);
|
||||||
fieldList.add(map);
|
map.put("type", type);
|
||||||
|
fieldList.add(map);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user