Skip to content

Commit

Permalink
Elasticsearch geo_point type support by converting to varchar
Browse files Browse the repository at this point in the history
  • Loading branch information
VenkatasivareddyTR authored and AbdulR3hman committed Oct 14, 2024
1 parent 4f2e1d7 commit f94f5d3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ private static FieldType toFieldType(Map<String, Object> mapping)
case "text":
case "keyword":
case "binary":
case "geo_point":
minorType = Types.MinorType.VARCHAR;
break;
case "long":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,8 @@ private Extractor makeVarCharExtractor(Field field)
if (fieldValue instanceof String) {
dst.value = (String) fieldValue;
}
else if (fieldValue instanceof List) {
Object value = ((List) fieldValue).get(0);
if (value instanceof String) {
dst.value = (String) value;
}
else {
dst.isSet = 0;
}
else if (fieldValue instanceof List || fieldValue instanceof Map) {
dst.value = fieldValue.toString();
}
else {
dst.isSet = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void makeVarCharExtractorTest()

Map<String, Object> expectedResults = ImmutableMap.of(
"mytext", "My favorite Sci-Fi movie is Interstellar.",
"mytextlist", "Hey, this is an array!");
"mytextlist", "[Hey, this is an array!, Wasn't expecting this!]");
Map<String, Object> extractedResults = testField(mapping, document);
logger.info("makeVarCharExtractorTest - Expected: {}, Extracted: {}", expectedResults, extractedResults);
assertEquals("Extracted results are not as expected!", expectedResults, extractedResults);
Expand Down

0 comments on commit f94f5d3

Please sign in to comment.