{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/coveo/main/json-schema/coveo-search-restgroupbyresult-schema.json",
  "title": "Coveo Search RestGroupByResult",
  "required": [
    "field",
    "globalComputedFieldResults",
    "values"
  ],
  "type": "object",
  "properties": {
    "field": {
      "type": "string",
      "description": "The field on which the Group By operation was executed.",
      "example": "@author"
    },
    "values": {
      "type": "array",
      "description": "The resulting Group By values.",
      "example": [
        {
          "value": "Bob Jones",
          "numberOfResults": 42,
          "score": 0,
          "valueType": "Standard",
          "computedFieldResults": [
            243.72
          ],
          "lookupValue": ""
        },
        {
          "value": "Erika Miller",
          "numberOfResults": 37,
          "score": 0,
          "valueType": "Standard",
          "computedFieldResults": [
            201.82
          ],
          "lookupValue": ""
        },
        {
          "value": "David Allen",
          "numberOfResults": 24,
          "score": 0,
          "valueType": "Standard",
          "computedFieldResults": [
            177.56
          ],
          "lookupValue": ""
        },
        {
          "value": "Carrie Green",
          "numberOfResults": 11,
          "score": 0,
          "valueType": "Standard",
          "computedFieldResults": [
            143.92
          ],
          "lookupValue": ""
        },
        {
          "value": "Anonymous",
          "numberOfResults": 77,
          "score": 0,
          "valueType": "Standard",
          "computedFieldResults": [
            122.85
          ],
          "lookupValue": ""
        }
      ],
      "items": {
        "required": [
          "computedFieldResults",
          "lookupValue",
          "numberOfResults",
          "score",
          "value",
          "valueType"
        ],
        "type": "object",
        "properties": {
          "value": {
            "type": "string",
            "description": "The Group By value name.",
            "example": "Bob Jones"
          },
          "numberOfResults": {
            "type": "integer",
            "description": "The number of query result items having this field value.",
            "format": "int32",
            "example": 42
          },
          "score": {
            "type": "integer",
            "description": "The Group By value score, computed from the `numberOfResults` value as well as from the position of the items having this value in the ranked query result set.",
            "format": "int32",
            "example": 0
          },
          "valueType": {
            "type": "string",
            "description": "The type of Group By value.",
            "example": "Standard"
          },
          "computedFieldResults": {
            "type": "array",
            "description": "The results of the computed fields (see the `computedFields` Group By parameter).",
            "example": [
              243.72
            ],
            "items": {
              "type": "number",
              "format": "float"
            }
          },
          "lookupValue": {
            "type": "string",
            "description": "> This property is deprecated; it should normally not be populated if the query was sent against a Coveo Cloud V2 index.\n\nThe lookup field value name.",
            "deprecated": true
          },
          "Value": {
            "type": "string",
            "description": "> This property is deprecated; it should not be populated by Search API V2 searches.",
            "deprecated": true
          },
          "NumberOfResults": {
            "type": "integer",
            "description": "> This property is deprecated; it should not be populated by Search API V2 searches.",
            "format": "int32",
            "deprecated": true
          },
          "Score": {
            "type": "integer",
            "description": "> This property is deprecated; it should not be populated by Search API V2 searches.",
            "format": "int32",
            "deprecated": true
          },
          "ComputedFieldResults": {
            "type": "array",
            "description": "> This property is deprecated; it should not be populated by Search API V2 searches.",
            "deprecated": true,
            "items": {
              "type": "number",
              "format": "double"
            }
          },
          "LookupValue": {
            "type": "string",
            "description": "> This property is deprecated; it should not be populated by Search API V2 searches.",
            "deprecated": true
          }
        }
      }
    },
    "globalComputedFieldResults": {
      "type": "array",
      "description": "The global computed fields that were processed by the index.",
      "items": {
        "type": "number",
        "format": "double"
      }
    },
    "Field": {
      "type": "string",
      "description": "> This property is deprecated and Coveo Cloud V1 only; The lowercase `field` should be used instead.",
      "deprecated": true
    },
    "GlobalComputedFieldResults": {
      "type": "array",
      "description": "> This property is deprecated and V1 only; The lowercase `globalComputedFieldResults` should be used instead.",
      "deprecated": true,
      "items": {
        "type": "number",
        "format": "double"
      }
    }
  }
}