OpenSearch DSL

pydantic model Term

Show JSON schema
{
   "title": "Term",
   "type": "object",
   "properties": {
      "field": {
         "title": "Field",
         "type": "string"
      },
      "value": {
         "title": "Value",
         "type": "string"
      },
      "case_insensitive": {
         "default": false,
         "title": "Case Insensitive",
         "type": "boolean"
      },
      "boost": {
         "default": 1.0,
         "minimum": 0.0,
         "title": "Boost",
         "type": "number"
      }
   },
   "required": [
      "field",
      "value"
   ]
}

Config:
  • validate_assignment: bool = True

Fields:
field boost: float = 1.0
Constraints:
  • ge = 0.0

field case_insensitive: bool = False
field field: str [Required]
field value: str [Required]
serialise() dict[str, Any]
pydantic model Exists

Show JSON schema
{
   "title": "Exists",
   "type": "object",
   "properties": {
      "field": {
         "title": "Field",
         "type": "string"
      },
      "boost": {
         "default": 1.0,
         "minimum": 0.0,
         "title": "Boost",
         "type": "number"
      }
   },
   "required": [
      "field"
   ]
}

Config:
  • validate_assignment: bool = True

Fields:
field boost: float = 1.0
Constraints:
  • ge = 0.0

field field: str [Required]
serialise() dict[str, Any]
pydantic model Range

Show JSON schema
{
   "title": "Range",
   "type": "object",
   "properties": {
      "field": {
         "title": "Field",
         "type": "string"
      },
      "gte": {
         "default": null,
         "title": "Gte"
      },
      "gt": {
         "default": null,
         "title": "Gt"
      },
      "lte": {
         "default": null,
         "title": "Lte"
      },
      "lt": {
         "default": null,
         "title": "Lt"
      },
      "boost": {
         "default": 1.0,
         "minimum": 0.0,
         "title": "Boost",
         "type": "number"
      }
   },
   "required": [
      "field"
   ]
}

Config:
  • validate_assignment: bool = True

Fields:
Validators:
field boost: float = 1.0
Constraints:
  • ge = 0.0

Validated by:
field field: str [Required]
Validated by:
field gt: Any = None
Validated by:
field gte: Any = None
Validated by:
field lt: Any = None
Validated by:
field lte: Any = None
Validated by:
validator require_something  »  all fields
serialise(handler) dict[str, Any]
pydantic model Match

Show JSON schema
{
   "title": "Match",
   "type": "object",
   "properties": {
      "field": {
         "title": "Field",
         "type": "string"
      },
      "query": {
         "title": "Query",
         "type": "string"
      }
   },
   "required": [
      "field",
      "query"
   ]
}

Config:
  • validate_assignment: bool = True

Fields:
field field: str [Required]
field query: str [Required]
serialise() dict[str, Any]
pydantic model MultiMatch

Show JSON schema
{
   "title": "MultiMatch",
   "type": "object",
   "properties": {
      "query": {
         "title": "Query",
         "type": "string"
      },
      "fields": {
         "items": {
            "type": "string"
         },
         "title": "Fields",
         "type": "array"
      }
   },
   "required": [
      "query",
      "fields"
   ]
}

Config:
  • validate_assignment: bool = True

Fields:
field fields: list[str] [Required]
field query: str [Required]
serialise() dict[str, Any]
pydantic model Wildcard

Show JSON schema
{
   "title": "Wildcard",
   "type": "object",
   "properties": {
      "field": {
         "title": "Field",
         "type": "string"
      },
      "query": {
         "title": "Query",
         "type": "string"
      },
      "case_insensitive": {
         "default": false,
         "title": "Case Insensitive",
         "type": "boolean"
      }
   },
   "required": [
      "field",
      "query"
   ]
}

Config:
  • validate_assignment: bool = True

  • populate_by_name: bool = True

Fields:

Validators:

pydantic model Regexp

Show JSON schema
{
   "title": "Regexp",
   "type": "object",
   "properties": {
      "field": {
         "title": "Field",
         "type": "string"
      },
      "query": {
         "title": "Query",
         "type": "string"
      },
      "case_insensitive": {
         "default": false,
         "title": "Case Insensitive",
         "type": "boolean"
      }
   },
   "required": [
      "field",
      "query"
   ]
}

Config:
  • validate_assignment: bool = True

  • populate_by_name: bool = True

Fields:

Validators:

pydantic model Bool

Show JSON schema
{
   "$defs": {
      "Bool": {
         "properties": {
            "must": {
               "default": [],
               "items": {
                  "anyOf": [
                     {
                        "$ref": "#/$defs/Term"
                     },
                     {
                        "$ref": "#/$defs/Exists"
                     },
                     {
                        "$ref": "#/$defs/Range"
                     },
                     {
                        "$ref": "#/$defs/Match"
                     },
                     {
                        "$ref": "#/$defs/MultiMatch"
                     },
                     {
                        "$ref": "#/$defs/Wildcard"
                     },
                     {
                        "$ref": "#/$defs/Regexp"
                     },
                     {
                        "$ref": "#/$defs/Bool"
                     }
                  ]
               },
               "title": "Must",
               "type": "array"
            },
            "must_not": {
               "default": [],
               "items": {
                  "anyOf": [
                     {
                        "$ref": "#/$defs/Term"
                     },
                     {
                        "$ref": "#/$defs/Exists"
                     },
                     {
                        "$ref": "#/$defs/Range"
                     },
                     {
                        "$ref": "#/$defs/Match"
                     },
                     {
                        "$ref": "#/$defs/MultiMatch"
                     },
                     {
                        "$ref": "#/$defs/Wildcard"
                     },
                     {
                        "$ref": "#/$defs/Regexp"
                     },
                     {
                        "$ref": "#/$defs/Bool"
                     }
                  ]
               },
               "title": "Must Not",
               "type": "array"
            },
            "should": {
               "default": [],
               "items": {
                  "anyOf": [
                     {
                        "$ref": "#/$defs/Term"
                     },
                     {
                        "$ref": "#/$defs/Exists"
                     },
                     {
                        "$ref": "#/$defs/Range"
                     },
                     {
                        "$ref": "#/$defs/Match"
                     },
                     {
                        "$ref": "#/$defs/MultiMatch"
                     },
                     {
                        "$ref": "#/$defs/Wildcard"
                     },
                     {
                        "$ref": "#/$defs/Regexp"
                     },
                     {
                        "$ref": "#/$defs/Bool"
                     }
                  ]
               },
               "title": "Should",
               "type": "array"
            },
            "filter": {
               "default": [],
               "items": {
                  "anyOf": [
                     {
                        "$ref": "#/$defs/Term"
                     },
                     {
                        "$ref": "#/$defs/Exists"
                     },
                     {
                        "$ref": "#/$defs/Range"
                     },
                     {
                        "$ref": "#/$defs/Match"
                     },
                     {
                        "$ref": "#/$defs/MultiMatch"
                     },
                     {
                        "$ref": "#/$defs/Wildcard"
                     },
                     {
                        "$ref": "#/$defs/Regexp"
                     },
                     {
                        "$ref": "#/$defs/Bool"
                     }
                  ]
               },
               "title": "Filter",
               "type": "array"
            },
            "minimum_should_match": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Minimum Should Match"
            }
         },
         "title": "Bool",
         "type": "object"
      },
      "Exists": {
         "properties": {
            "field": {
               "title": "Field",
               "type": "string"
            },
            "boost": {
               "default": 1.0,
               "minimum": 0.0,
               "title": "Boost",
               "type": "number"
            }
         },
         "required": [
            "field"
         ],
         "title": "Exists",
         "type": "object"
      },
      "Match": {
         "properties": {
            "field": {
               "title": "Field",
               "type": "string"
            },
            "query": {
               "title": "Query",
               "type": "string"
            }
         },
         "required": [
            "field",
            "query"
         ],
         "title": "Match",
         "type": "object"
      },
      "MultiMatch": {
         "properties": {
            "query": {
               "title": "Query",
               "type": "string"
            },
            "fields": {
               "items": {
                  "type": "string"
               },
               "title": "Fields",
               "type": "array"
            }
         },
         "required": [
            "query",
            "fields"
         ],
         "title": "MultiMatch",
         "type": "object"
      },
      "Range": {
         "properties": {
            "field": {
               "title": "Field",
               "type": "string"
            },
            "gte": {
               "default": null,
               "title": "Gte"
            },
            "gt": {
               "default": null,
               "title": "Gt"
            },
            "lte": {
               "default": null,
               "title": "Lte"
            },
            "lt": {
               "default": null,
               "title": "Lt"
            },
            "boost": {
               "default": 1.0,
               "minimum": 0.0,
               "title": "Boost",
               "type": "number"
            }
         },
         "required": [
            "field"
         ],
         "title": "Range",
         "type": "object"
      },
      "Regexp": {
         "properties": {
            "field": {
               "title": "Field",
               "type": "string"
            },
            "query": {
               "title": "Query",
               "type": "string"
            },
            "case_insensitive": {
               "default": false,
               "title": "Case Insensitive",
               "type": "boolean"
            }
         },
         "required": [
            "field",
            "query"
         ],
         "title": "Regexp",
         "type": "object"
      },
      "Term": {
         "properties": {
            "field": {
               "title": "Field",
               "type": "string"
            },
            "value": {
               "title": "Value",
               "type": "string"
            },
            "case_insensitive": {
               "default": false,
               "title": "Case Insensitive",
               "type": "boolean"
            },
            "boost": {
               "default": 1.0,
               "minimum": 0.0,
               "title": "Boost",
               "type": "number"
            }
         },
         "required": [
            "field",
            "value"
         ],
         "title": "Term",
         "type": "object"
      },
      "Wildcard": {
         "properties": {
            "field": {
               "title": "Field",
               "type": "string"
            },
            "query": {
               "title": "Query",
               "type": "string"
            },
            "case_insensitive": {
               "default": false,
               "title": "Case Insensitive",
               "type": "boolean"
            }
         },
         "required": [
            "field",
            "query"
         ],
         "title": "Wildcard",
         "type": "object"
      }
   },
   "allOf": [
      {
         "$ref": "#/$defs/Bool"
      }
   ]
}

Config:
  • validate_assignment: bool = True

Fields:
Validators:
field filter: Sequence[Term | Exists | Range | Match | MultiMatch | Wildcard | Regexp | Bool] = []
Validated by:
field minimum_should_match: int | None = None
Validated by:
field must: Sequence[Term | Exists | Range | Match | MultiMatch | Wildcard | Regexp | Bool] = []
Validated by:
field must_not: Sequence[Term | Exists | Range | Match | MultiMatch | Wildcard | Regexp | Bool] = []
Validated by:
field should: Sequence[Term | Exists | Range | Match | MultiMatch | Wildcard | Regexp | Bool] = []
Validated by:
validator require_something  »  all fields
serialise(handler) dict[str, Any]
class SortOrder(value)

An enumeration.

pydantic model OrderBy

Show JSON schema
{
   "title": "OrderBy",
   "type": "object",
   "properties": {
      "field": {
         "title": "Field",
         "type": "string"
      },
      "order": {
         "anyOf": [
            {
               "$ref": "#/$defs/SortOrder"
            },
            {
               "type": "string"
            }
         ],
         "title": "Order"
      }
   },
   "$defs": {
      "SortOrder": {
         "enum": [
            "asc",
            "desc"
         ],
         "title": "SortOrder",
         "type": "string"
      }
   },
   "required": [
      "field",
      "order"
   ]
}

Config:
  • validate_assignment: bool = True

Fields:
Validators:
field field: str [Required]
field order: SortOrder | str [Required]
Validated by:
validator parse_order  »  order
serialise() dict[str, Any]
pydantic model Query

Show JSON schema
{
   "title": "Query",
   "type": "object",
   "properties": {
      "query": {
         "anyOf": [
            {
               "$ref": "#/$defs/Term"
            },
            {
               "$ref": "#/$defs/Exists"
            },
            {
               "$ref": "#/$defs/Range"
            },
            {
               "$ref": "#/$defs/Match"
            },
            {
               "$ref": "#/$defs/MultiMatch"
            },
            {
               "$ref": "#/$defs/Wildcard"
            },
            {
               "$ref": "#/$defs/Regexp"
            },
            {
               "$ref": "#/$defs/Bool"
            }
         ],
         "title": "Query"
      },
      "size": {
         "anyOf": [
            {
               "exclusiveMinimum": 0,
               "type": "integer"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Size"
      },
      "sort": {
         "default": [],
         "items": {
            "$ref": "#/$defs/OrderBy"
         },
         "title": "Sort",
         "type": "array"
      }
   },
   "$defs": {
      "Bool": {
         "properties": {
            "must": {
               "default": [],
               "items": {
                  "anyOf": [
                     {
                        "$ref": "#/$defs/Term"
                     },
                     {
                        "$ref": "#/$defs/Exists"
                     },
                     {
                        "$ref": "#/$defs/Range"
                     },
                     {
                        "$ref": "#/$defs/Match"
                     },
                     {
                        "$ref": "#/$defs/MultiMatch"
                     },
                     {
                        "$ref": "#/$defs/Wildcard"
                     },
                     {
                        "$ref": "#/$defs/Regexp"
                     },
                     {
                        "$ref": "#/$defs/Bool"
                     }
                  ]
               },
               "title": "Must",
               "type": "array"
            },
            "must_not": {
               "default": [],
               "items": {
                  "anyOf": [
                     {
                        "$ref": "#/$defs/Term"
                     },
                     {
                        "$ref": "#/$defs/Exists"
                     },
                     {
                        "$ref": "#/$defs/Range"
                     },
                     {
                        "$ref": "#/$defs/Match"
                     },
                     {
                        "$ref": "#/$defs/MultiMatch"
                     },
                     {
                        "$ref": "#/$defs/Wildcard"
                     },
                     {
                        "$ref": "#/$defs/Regexp"
                     },
                     {
                        "$ref": "#/$defs/Bool"
                     }
                  ]
               },
               "title": "Must Not",
               "type": "array"
            },
            "should": {
               "default": [],
               "items": {
                  "anyOf": [
                     {
                        "$ref": "#/$defs/Term"
                     },
                     {
                        "$ref": "#/$defs/Exists"
                     },
                     {
                        "$ref": "#/$defs/Range"
                     },
                     {
                        "$ref": "#/$defs/Match"
                     },
                     {
                        "$ref": "#/$defs/MultiMatch"
                     },
                     {
                        "$ref": "#/$defs/Wildcard"
                     },
                     {
                        "$ref": "#/$defs/Regexp"
                     },
                     {
                        "$ref": "#/$defs/Bool"
                     }
                  ]
               },
               "title": "Should",
               "type": "array"
            },
            "filter": {
               "default": [],
               "items": {
                  "anyOf": [
                     {
                        "$ref": "#/$defs/Term"
                     },
                     {
                        "$ref": "#/$defs/Exists"
                     },
                     {
                        "$ref": "#/$defs/Range"
                     },
                     {
                        "$ref": "#/$defs/Match"
                     },
                     {
                        "$ref": "#/$defs/MultiMatch"
                     },
                     {
                        "$ref": "#/$defs/Wildcard"
                     },
                     {
                        "$ref": "#/$defs/Regexp"
                     },
                     {
                        "$ref": "#/$defs/Bool"
                     }
                  ]
               },
               "title": "Filter",
               "type": "array"
            },
            "minimum_should_match": {
               "anyOf": [
                  {
                     "type": "integer"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Minimum Should Match"
            }
         },
         "title": "Bool",
         "type": "object"
      },
      "Exists": {
         "properties": {
            "field": {
               "title": "Field",
               "type": "string"
            },
            "boost": {
               "default": 1.0,
               "minimum": 0.0,
               "title": "Boost",
               "type": "number"
            }
         },
         "required": [
            "field"
         ],
         "title": "Exists",
         "type": "object"
      },
      "Match": {
         "properties": {
            "field": {
               "title": "Field",
               "type": "string"
            },
            "query": {
               "title": "Query",
               "type": "string"
            }
         },
         "required": [
            "field",
            "query"
         ],
         "title": "Match",
         "type": "object"
      },
      "MultiMatch": {
         "properties": {
            "query": {
               "title": "Query",
               "type": "string"
            },
            "fields": {
               "items": {
                  "type": "string"
               },
               "title": "Fields",
               "type": "array"
            }
         },
         "required": [
            "query",
            "fields"
         ],
         "title": "MultiMatch",
         "type": "object"
      },
      "OrderBy": {
         "properties": {
            "field": {
               "title": "Field",
               "type": "string"
            },
            "order": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/SortOrder"
                  },
                  {
                     "type": "string"
                  }
               ],
               "title": "Order"
            }
         },
         "required": [
            "field",
            "order"
         ],
         "title": "OrderBy",
         "type": "object"
      },
      "Range": {
         "properties": {
            "field": {
               "title": "Field",
               "type": "string"
            },
            "gte": {
               "default": null,
               "title": "Gte"
            },
            "gt": {
               "default": null,
               "title": "Gt"
            },
            "lte": {
               "default": null,
               "title": "Lte"
            },
            "lt": {
               "default": null,
               "title": "Lt"
            },
            "boost": {
               "default": 1.0,
               "minimum": 0.0,
               "title": "Boost",
               "type": "number"
            }
         },
         "required": [
            "field"
         ],
         "title": "Range",
         "type": "object"
      },
      "Regexp": {
         "properties": {
            "field": {
               "title": "Field",
               "type": "string"
            },
            "query": {
               "title": "Query",
               "type": "string"
            },
            "case_insensitive": {
               "default": false,
               "title": "Case Insensitive",
               "type": "boolean"
            }
         },
         "required": [
            "field",
            "query"
         ],
         "title": "Regexp",
         "type": "object"
      },
      "SortOrder": {
         "enum": [
            "asc",
            "desc"
         ],
         "title": "SortOrder",
         "type": "string"
      },
      "Term": {
         "properties": {
            "field": {
               "title": "Field",
               "type": "string"
            },
            "value": {
               "title": "Value",
               "type": "string"
            },
            "case_insensitive": {
               "default": false,
               "title": "Case Insensitive",
               "type": "boolean"
            },
            "boost": {
               "default": 1.0,
               "minimum": 0.0,
               "title": "Boost",
               "type": "number"
            }
         },
         "required": [
            "field",
            "value"
         ],
         "title": "Term",
         "type": "object"
      },
      "Wildcard": {
         "properties": {
            "field": {
               "title": "Field",
               "type": "string"
            },
            "query": {
               "title": "Query",
               "type": "string"
            },
            "case_insensitive": {
               "default": false,
               "title": "Case Insensitive",
               "type": "boolean"
            }
         },
         "required": [
            "field",
            "query"
         ],
         "title": "Wildcard",
         "type": "object"
      }
   },
   "required": [
      "query"
   ]
}

Config:
  • validate_assignment: bool = True

Fields:
field query: QueryType [Required]
field size: int | None = None
Constraints:
  • gt = 0

field sort: list[OrderBy] = []