Я пытаюсь изменить формат вывода сервера Gremlin http на типизированный объект JSON, как показано ниже.
{
"requestId": "320599c8-7d49-4cc6-87a6-42115009f90c",
"status": {
"message": "",
"code": 200,
"attributes": {}
},
"result": {
"data": [
{
"info": [
{
"total_seen": [
2845
],
"first_seen": [
1501568446000
],
"last_seen": [
1580157081000
],
"value": [
"http://test.com"
]
}
]
}
],
"meta": {}
}
}
Но ответ, который я получаю от сервера, является типизированным one
{
"requestId": "e8621470-7ee7-4f6b-a8ea-1d49c85093c8",
"status": {
"message": "",
"code": 200,
"attributes": {
"@type": "g:Map",
"@value": []
}
},
"result": {
"data": {
"@type": "g:List",
"@value": [
{
"@type": "g:Map",
"@value": [
"info",
{
"@type": "g:List",
"@value": [
{
"@type": "g:Map",
"@value": [
"total_seen",
{
"@type": "g:List",
"@value": [
{
"@type": "g:Int32",
"@value": 2797
}
]
},
"first_seen",
{
"@type": "g:List",
"@value": [
{
"@type": "g:Int64",
"@value": 1501568446000
}
]
},
"last_seen",
{
"@type": "g:List",
"@value": [
{
"@type": "g:Int64",
"@value": 1578774368000
}
]
},
"vertex_type",
{
"@type": "g:List",
"@value": [
"url"
]
},
"url_value",
{
"@type": "g:List",
"@value": [
"http://test.com"
]
}
]
}
]
}
]
}
]
},
"meta": {
"@type": "g:Map",
"@value": []
}
}
}
Я попытался изменить настройки в gremlin-server.yaml, прокомментировав GraphSON V2 и V3
# Copyright 2019 JanusGraph Authors
#
# 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.
host: 127.0.0.1
port: 8182
scriptEvaluationTimeout: 30000
channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
graphs: {
graph: conf/gremlin-server/janusgraph-cassandra-es-server.properties
}
scriptEngines: {
gremlin-groovy: {
plugins: { org.janusgraph.graphdb.tinkerpop.plugin.JanusGraphGremlinPlugin: {},
org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
org.apache.tinkerpop.gremlin.tinkergraph.jsr223.TinkerGraphGremlinPlugin: {},
org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]},
org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: [scripts/empty-sample.groovy]}}}}
serializers:
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { serializeResultToString: true }}
# - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
# Older serialization versions for backwards compatibility:
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0, config: {ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }}
# - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }}
processors:
- { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }}
- { className: org.apache.tinkerpop.gremlin.server.op.traversal.TraversalOpProcessor, config: { cacheExpirationTime: 600000, cacheMaxSize: 1000 }}
metrics: {
consoleReporter: {enabled: true, interval: 180000},
csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv},
jmxReporter: {enabled: true},
slf4jReporter: {enabled: true, interval: 180000},
gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
graphiteReporter: {enabled: false, interval: 180000}}
maxInitialLineLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536
maxAccumulationBufferComponents: 1024
Я был бы очень рад, если бы кто-то мог сказать мне, что я делаю здесь не так. Благодаря.