Documents and their sub-objects (entities, associations, user metadata, aggregations)

Query API Call

The query API call returns a complex JSON object, which consists primarily of document data and document sub-objects (aggregations such as entities, associations, moments etc.)

In this section:

Query response format
{
    "response": {
        "action": "Query",
        "success": true,
        "message": string, // A human readable version of the query
        "time": integer // The number of milliseconds spent in the server to perform the query
    },
    "stats": {
        "found": integer, // the number of documents matching the query
        "start": integer, // the number of documents skipped (in score order) to get the "data" return array below
        "maxScore": number, // the highest score in the returned documents
        "avgScore": number // the average score across all analyzed documents ("score.numAnalyze" in the query, default 1000)
    },
    "data": [
        {...} // The document objects described in link below below
    ],

    // Aggregations of document sub-objects

    "events": [
        {...} // The association objects described in link below, "assoc_type": "Event"
    ],
    "facts": [
        {...} // The association objects described in link below, "assoc_type": "Fact"
    ],
    "entities": [
        {...} // The entity objects described below
    ],

    // Other aggregations

    "geo": [
        {...} // See link to aggregation objects
    ],
    "maxGeoCount": long,

    "times": [
        {...} // See link to aggregation objects
    ],
    "timeInterval": long,

	"moments": [
		{...} // See link to aggregation objects
	],
    "momentsInterval": long,

    "sources": [
        {...} // See link to aggregation objects
    ],
    "sourceMetaTags": [
        {...} // See link to aggregation objects
    ],
    "sourceMetaTypes": [
        {...} // See link to aggregation objects
    ],

}

Field Guide

In this complex JSON object, the various aggregation formats are specified in the query process documentation.

The key objects in the JSON are documents, and its sub-objects entities, associations, and source-specific metadata.

In addition to the query API call, these can also be accessed in other ways, eg via the knowledge/document/get API call, or via the Widget API.

The entities and associations are both sub-objects of the document object, but also "aggregation" objects in their own right. The differences are described here.

Note that when the community GUI is used to save the results of a query, the saved JSON format is identical to the above, except with "documents" instead of "data".

Related Documentation:

Widget Framework