Skip to content

Commit

Permalink
Compatible ES6 and ES7 close #4998
Browse files Browse the repository at this point in the history
  • Loading branch information
peacewong committed Nov 29, 2023
1 parent 332e11e commit a1bf43f
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ public List<String> getTypes(String index) throws Exception {
}

public Map<Object, Object> getProps(String index, String type) throws Exception {
Request request = new Request("GET", index + "/_mappings/" + type);
Request request = new Request("GET", index + "/_mappings");
Response response = restClient.performRequest(request);
Map<String, Map<String, Object>> result =
Json.fromJson(response.getEntity().getContent(), Map.class);
Map mappings = (Map) result.get(index).get("mappings");
Map mappings = (Map) result.get(index).get(DEFAULT_MAPPING_NAME);
Map propsMap = mappings;
if (mappings.containsKey(type)) {
Object typeMap = mappings.get(type);
Expand All @@ -124,10 +124,10 @@ public Map<Object, Object> getProps(String index, String type) throws Exception
}
}
Object props = propsMap.get(FIELD_PROPS);
if (props instanceof Map) {
if (null != props && props instanceof Map) {
return (Map) props;
}
return null;
return propsMap;
}

public void ping() throws IOException {
Expand Down

0 comments on commit a1bf43f

Please sign in to comment.