test(common-es): update metrics index test
MODIFY
common/es/src/main/java/io/apiman/common/es/util/builder/index/EsDynamicTemplate.java
common/es/src/main/java/io/apiman/common/es/util/builder/index/EsDynamicTemplate.java
+/*
+ * Copyright 2022 Black Parrot Labs Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package io.apiman.common.es.util.builder.index;
import com.fasterxml.jackson.annotation.JsonInclude;
@@ -6,7 +21,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
/**
- *
+ * <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.17/dynamic-templates.html">Elasticsearch dynamic template</a> builder.
*
* @author Marc Savy {@literal <marc@blackparrotlabs.io>}
*/

MODIFY
common/es/src/main/java/io/apiman/common/es/util/builder/index/EsField.java
common/es/src/main/java/io/apiman/common/es/util/builder/index/EsField.java
*/
package io.apiman.common.es.util.builder.index;
-import static io.apiman.common.es.util.EsConstants.ES_MAPPING_TYPE_KEYWORD;
-import static io.apiman.common.util.Preconditions.checkArgument;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
+import static io.apiman.common.es.util.EsConstants.ES_MAPPING_TYPE_KEYWORD;
+import static io.apiman.common.util.Preconditions.checkArgument;
+
/**
- * An ES field
+ * <a href="https://www.elastic.co/guide/en/elasticsearch/reference/7.17/mapping-types.html">An Elasticsearch field</a>
*
* @author Marc Savy {@literal <marc@blackparrotlabs.io>}
*/

MODIFY
common/es/src/test/resources/index-samples/OutputIndex.json
common/es/src/test/resources/index-samples/OutputIndex.json
{
+ "dynamic_templates": [],
"properties": {
+ "apiDuration": {
+ "type": "long"
+ },
"apiEnd": {
"type": "date"
},
- "clientVersion" : {
+ "apiId": {
"type": "keyword"
},
- "error" : {
- "type" : "boolean"
+ "apiOrgId": {
+ "type": "keyword"
},
- "responseCode" : {
- "type" : "long"
+ "apiStart": {
+ "type": "date"
},
"apiVersion": {
"type": "keyword"
"bytesDownloaded": {
"type": "long"
},
- "requestDuration" : {
+ "bytesUploaded": {
"type": "long"
},
- "requestStart" : {
- "type" : "date"
+ "clientId": {
+ "type": "keyword"
},
"clientOrgId": {
"type": "keyword"
},
- "planId" : {
+ "clientVersion": {
"type": "keyword"
},
- "apiId" : {
+ "contractId": {
"type": "keyword"
},
- "remoteAddr" : {
- "type" : "ip"
- },
- "bytesUploaded" : {
- "type" : "long"
+ "error": {
+ "type": "boolean"
},
- "apiOrgId" : {
+ "errorMessage": {
+ "fields": {
+ "keyword": {
+ "ignore_above": 256,
"type": "keyword"
+ }
},
- "clientId" : {
- "type" : "keyword"
+ "type": "text"
+ },
+ "failure": {
+ "type": "boolean"
},
"failureCode": {
"type": "long"
},
- "method" : {
- "type" : "keyword"
- },
- "resource" : {
- "type" : "text",
+ "failureReason": {
"fields": {
"keyword": {
- "type" : "keyword",
- "ignore_above" : 256
- }
+ "ignore_above": 256,
+ "type": "keyword"
}
},
- "apiStart" : {
+ "type": "text"
+ },
+ "method": {
+ "type": "keyword"
+ },
+ "planId": {
+ "type": "keyword"
+ },
+ "remoteAddr": {
+ "type": "ip"
+ },
+ "requestDuration": {
+ "type": "long"
+ },
+ "requestEnd": {
"type": "date"
},
- "errorMessage" : {
- "type" : "text",
- "fields" : {
- "keyword" : {
- "type" : "keyword",
- "ignore_above" : 256
- }
- }
+ "requestStart": {
+ "type": "date"
},
- "url" : {
- "type" : "text",
+ "resource": {
"fields": {
"keyword": {
- "type" : "keyword",
- "ignore_above" : 256
- }
+ "ignore_above": 256,
+ "type": "keyword"
}
},
- "failure" : {
- "type" : "boolean"
+ "type": "text"
},
- "apiDuration" : {
+ "responseCode": {
"type": "long"
},
- "failureReason" : {
- "type" : "text",
+ "responseMessage": {
"fields": {
"keyword": {
- "type" : "keyword",
- "ignore_above" : 256
- }
- }
- },
- "contractId" : {
+ "ignore_above": 256,
"type": "keyword"
+ }
},
- "requestEnd" : {
- "type" : "date"
+ "type": "text"
},
- "responseMessage" : {
- "type" : "text",
+ "url": {
"fields": {
"keyword": {
- "type" : "keyword",
- "ignore_above" : 256
- }
+ "ignore_above": 256,
+ "type": "keyword"
}
},
+ "type": "text"
+ },
"user": {
- "type" : "text",
"fields": {
"keyword": {
- "type" : "keyword",
- "ignore_above" : 256
- }
+ "ignore_above": 256,
+ "type": "keyword"
}
+ },
+ "type": "text"
}
}
}

MODIFY
gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/EsMetrics.java
gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/EsMetrics.java
@@ -64,9 +64,9 @@ import static io.apiman.gateway.engine.storage.util.BackingStoreUtil.JSON_MAPPER
/**
* An elasticsearch implementation of the {@link IMetrics} interface.
- *
+ * <p>
* Can also dynamically capture headers and query parameters.
- * See available options in
+ * See available options in {@link EsMetricsClientOptionsParser}.
*
* @author eric.wittmann@redhat.com
* @author marc@blackparrotlabs.io

MODIFY
gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/EsMetricsClientOptionsParser.java
gateway/engine/es/src/main/java/io/apiman/gateway/engine/es/EsMetricsClientOptionsParser.java
+/*
+ * Copyright 2022 Black Parrot Labs Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package io.apiman.gateway.engine.es;
import io.apiman.common.config.options.GenericOptionsParser;

test(common-es): update metrics index test