{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/couchbase/main/json-schema/couchbase-search-query-request-schema.json",
  "title": "SearchQueryRequest",
  "description": "Full-text search query request",
  "x-generated": "2026-10-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/couchbase-search-queries-api-openapi.yml#/components/schemas/SearchQueryRequest",
  "type": "object",
  "required": [
    "query"
  ],
  "properties": {
    "query": {
      "type": "object",
      "description": "The search query object. Supports match, term, phrase, boolean, numeric_range, date_range, geo_distance, geo_bounding_box, conjunction, and disjunction query types.",
      "properties": {
        "match": {
          "type": "string",
          "description": "Text to match against the index"
        },
        "field": {
          "type": "string",
          "description": "Specific field to search"
        },
        "analyzer": {
          "type": "string",
          "description": "Analyzer to use for the query"
        },
        "fuzziness": {
          "type": "integer",
          "description": "Fuzziness level for approximate matching",
          "minimum": 0,
          "maximum": 2
        },
        "prefix_length": {
          "type": "integer",
          "description": "Minimum prefix length for fuzzy matches"
        },
        "boost": {
          "type": "number",
          "description": "Boost factor for relevance scoring"
        }
      }
    },
    "size": {
      "type": "integer",
      "description": "Maximum number of results to return",
      "default": 10
    },
    "from": {
      "type": "integer",
      "description": "Offset for paginating results",
      "default": 0
    },
    "fields": {
      "type": "array",
      "description": "Fields to include in the response",
      "items": {
        "type": "string"
      }
    },
    "highlight": {
      "type": "object",
      "description": "Highlight configuration for matched terms",
      "properties": {
        "style": {
          "type": "string",
          "description": "Highlight style",
          "enum": [
            "html",
            "ansi"
          ]
        },
        "fields": {
          "type": "array",
          "description": "Fields to highlight",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "facets": {
      "type": "object",
      "description": "Facet definitions for aggregating results",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string",
            "description": "Field to facet on"
          },
          "size": {
            "type": "integer",
            "description": "Maximum number of facet values"
          }
        }
      }
    },
    "sort": {
      "type": "array",
      "description": "Sort order for results",
      "items": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "object"
          }
        ]
      }
    },
    "explain": {
      "type": "boolean",
      "description": "Whether to include scoring explanation"
    },
    "ctl": {
      "type": "object",
      "description": "Query control parameters",
      "properties": {
        "timeout": {
          "type": "integer",
          "description": "Query timeout in milliseconds"
        },
        "consistency": {
          "type": "object",
          "description": "Consistency requirements",
          "properties": {
            "level": {
              "type": "string",
              "description": "Consistency level",
              "enum": [
                "at_plus",
                "not_bounded"
              ]
            }
          }
        }
      }
    }
  }
}