Change the statement column type from Keyword to Text. (#2944)
* Use ids query method instead of get method for metrics persistence. #2933 * Query by alias name. * #2943 Change the statement column type from Keyword to Text.
This commit is contained in:
parent
4deae17fb3
commit
dea6cfb010
|
|
@ -34,7 +34,7 @@ public abstract class TopN extends Record implements ComparableStorageData {
|
|||
public static final String TRACE_ID = "trace_id";
|
||||
public static final String SERVICE_ID = "service_id";
|
||||
|
||||
@Getter @Setter @Column(columnName = STATEMENT) private String statement;
|
||||
@Getter @Setter @Column(columnName = STATEMENT, content = true) private String statement;
|
||||
@Getter @Setter @Column(columnName = LATENCY) private long latency;
|
||||
@Getter @Setter @Column(columnName = TRACE_ID) private String traceId;
|
||||
@Getter @Setter @Column(columnName = SERVICE_ID) private int serviceId;
|
||||
|
|
|
|||
|
|
@ -29,9 +29,23 @@ import org.apache.skywalking.oap.server.core.query.sql.Function;
|
|||
public @interface Column {
|
||||
String columnName();
|
||||
|
||||
/**
|
||||
* The column value is used in metrics value query.
|
||||
*/
|
||||
boolean isValue() default false;
|
||||
|
||||
/**
|
||||
* The function is used in aggregation query.
|
||||
*/
|
||||
Function function() default Function.None;
|
||||
|
||||
/**
|
||||
* Match query means using analyzer(if storage have) to do key word match query.
|
||||
*/
|
||||
boolean matchQuery() default false;
|
||||
|
||||
/**
|
||||
* The column is just saved, never used in query.
|
||||
*/
|
||||
boolean content() default false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@ public class ModelColumn {
|
|||
private final ColumnName columnName;
|
||||
private final Class<?> type;
|
||||
private final boolean matchQuery;
|
||||
private final boolean content;
|
||||
|
||||
public ModelColumn(ColumnName columnName, Class<?> type, boolean matchQuery) {
|
||||
public ModelColumn(ColumnName columnName, Class<?> type, boolean matchQuery, boolean content) {
|
||||
this.columnName = columnName;
|
||||
this.type = type;
|
||||
this.matchQuery = matchQuery;
|
||||
this.content = content;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class StorageModels implements IModelGetter, IModelSetter, IModelOverride
|
|||
for (Field field : fields) {
|
||||
if (field.isAnnotationPresent(Column.class)) {
|
||||
Column column = field.getAnnotation(Column.class);
|
||||
modelColumns.add(new ModelColumn(new ColumnName(column.columnName()), field.getType(), column.matchQuery()));
|
||||
modelColumns.add(new ModelColumn(new ColumnName(column.columnName()), field.getType(), column.matchQuery(), column.content()));
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("The field named {} with the {} type", column.columnName(), field.getType());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,6 +125,11 @@ public class StorageEsInstaller extends ModelInstaller {
|
|||
matchColumn.addProperty("type", "text");
|
||||
matchColumn.addProperty("analyzer", "oap_analyzer");
|
||||
properties.add(matchCName, matchColumn);
|
||||
} else if (columnDefine.isContent()) {
|
||||
JsonObject column = new JsonObject();
|
||||
column.addProperty("type", "text");
|
||||
column.addProperty("index", false);
|
||||
properties.add(columnDefine.getColumnName().getName(), column);
|
||||
} else {
|
||||
JsonObject column = new JsonObject();
|
||||
column.addProperty("type", columnTypeEsMapping.transform(columnDefine.getType()));
|
||||
|
|
|
|||
Loading…
Reference in New Issue