public String transform()

in oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/base/ColumnTypeEsMapping.java [31:54]


    public String transform(Class<?> type, Type genericType, int length, boolean storageOnly, final ElasticSearchExtension elasticSearchExtension) {
        if (Integer.class.equals(type) || int.class.equals(type) || Layer.class.equals(type)) {
            return "integer";
        } else if (Long.class.equals(type) || long.class.equals(type)) {
            return "long";
        } else if (Double.class.equals(type) || double.class.equals(type)) {
            return "double";
        } else if (String.class.equals(type) && storageOnly && length > 32766) {   // 32766 is the max length of a keywords field in ES
            return "text";
        } else if (String.class.equals(type) || elasticSearchExtension.isKeyword()) {
            return "keyword";
        } else if (StorageDataComplexObject.class.isAssignableFrom(type)) {
            return "text";
        } else if (byte[].class.equals(type)) {
            return "binary";
        } else if (JsonObject.class.equals(type)) {
            return "text";
        } else if (List.class.isAssignableFrom(type)) {
            final Type elementType = ((ParameterizedType) genericType).getActualTypeArguments()[0];
            return transform((Class<?>) elementType, elementType, length, storageOnly, elasticSearchExtension);
        } else {
            throw new IllegalArgumentException("Unsupported data type: " + type.getName());
        }
    }