All Products
Search
Document Center

:Query results in JSON format

Last Updated:Aug 27, 2024

If you set the value of the format parameter in a config clause to json, the query result is returned in JSON format. The following sample query result is in JSON format:

{
    "result":{
        "searchtime":0.001, // The query duration.
        "totalHits":10, // The total number of documents that match the search query.
        "numHits":10, // The number of documents that are returned.
              "coveredPercent" : 100.0, // The percentage of partitions that are scanned.
        "items":[ // The documents that are returned.
            {
                "fields":{ // The fields that are returned.
                    "normal_key":"normal_value",
                    "multi_key":"valuetvalue1"
                },
                "property":{ // The document information that you specify in the Query Result Searcher (QRS) plug-in. If you do not specify properties, the value of this parameter is empty.
                    "property_normal_key":"property_normal_value",
                    "property_multi_key":"valuetvalue1"
                },
                "attribute":{ // The attribute fields. If you include an attribute clause in the query statement, the values of the specified fields are returned.
                    "int_key":[
                        1,
                        2
                    ],
                    "double_key":[
                        1.1,
                        2.1
                    ],
                    "string_key":[
                        "1",
                        "2"
                    ],
                    "multi_key_attr":[
                        "valueu001Dvalue"
                    ]
                },
                "variableValue":{ // The serialized variables.
                    "variable_int_key":[
                        1,
                        2
                    ],
                    "variable_double_key":[
                        1.1,
                        2.1
                    ],
                    "variable_string_key":[
                        "1",
                        "2"
                    ],
                    "variable_multi_key_attr":[
                        "valueu001Dvalue"
                    ]
                },
                "sortExprValues":[ // The scores of the fields after sorting is performed.
                    "1.001",
                    "1.002"
                ],
                "tracerInfo":"tracer for hit" // The trace of the sorting operation.
            }
        ],
        "facet":[ // Statistics.
                                                {
                            "key":"expr1",
                            "items":[
                                {
                                    "value":"key1",
                                    "sum":"4444",
                                    "count":"123"
                                },
                                {
                                    "value":"key2",
                                    "sum":"5555",
                                    "count":"345"
                                }
                    ]
                }
        ]
    },
    "errors":[ // The error message.
        {
            "code":1,
            "message":"error"
        }
    ],
    "tracer":"trace infon" // The basic trace information of the request.
}