Searchcraft Search API

The Search API from Searchcraft — 2 operation(s) for search.

OpenAPI Specification

searchcraft-search-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Searchcraft Authentication Search API
  description: REST API for the Searchcraft developer search engine. Manage indexes and their schemas, ingest and delete documents, run fuzzy/exact full-text and federated search, and manage synonyms, stopwords, federations, access keys, and usage measurement. Available as the managed Searchcraft Cloud service and the self-hosted Searchcraft Core engine.
  termsOfService: https://www.searchcraft.io/
  contact:
    name: Searchcraft
    url: https://www.searchcraft.io/
  version: '1.0'
servers:
- url: https://your-cluster.searchcraft.io
  description: Searchcraft Cloud cluster endpoint. Each Searchcraft Cloud account is provisioned a unique cluster host; replace "your-cluster" with your cluster subdomain. Self-hosted Searchcraft Core instances use their own host.
security:
- SearchcraftKey: []
tags:
- name: Search
paths:
  /index/{index}/search:
    parameters:
    - $ref: '#/components/parameters/IndexName'
    post:
      operationId: search
      tags:
      - Search
      summary: Returns search results that match the query criteria.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchRequest'
      responses:
        '200':
          description: Search results.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
  /federation/{federation_name}/search:
    parameters:
    - $ref: '#/components/parameters/FederationName'
    post:
      operationId: federatedSearch
      tags:
      - Search
      summary: Returns search results across all indexes defined in a federation.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchRequest'
      responses:
        '200':
          description: Federated search results.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchResponse'
components:
  parameters:
    FederationName:
      name: federation_name
      in: path
      required: true
      description: The name of the federation.
      schema:
        type: string
    IndexName:
      name: index
      in: path
      required: true
      description: The name of the index.
      schema:
        type: string
  schemas:
    SearchResponse:
      type: object
      properties:
        status:
          type: integer
          example: 200
        data:
          type: object
          properties:
            hits:
              type: array
              items:
                $ref: '#/components/schemas/Hit'
            count:
              type: number
            time_taken:
              type: number
            facets:
              type: array
              items:
                type: object
    SearchRequest:
      type: object
      required:
      - query
      properties:
        query:
          description: A query object, or an array of query objects, expressed in fuzzy, exact, or dynamic mode.
          oneOf:
          - type: object
          - type: array
            items:
              type: object
        limit:
          type: integer
          default: 20
          description: Maximum number of results to return.
        offset:
          type: integer
          default: 0
          description: Number of results to skip for paging.
        order_by:
          type: string
          description: Field name to order results by.
        sort:
          type: string
          enum:
          - asc
          - desc
          default: desc
        occur:
          type: string
          enum:
          - should
          - must
          description: Boolean occurrence behavior for the query clause.
        minimum_number_should_match:
          type: integer
          minimum: 0
    Hit:
      type: object
      properties:
        doc:
          type: object
        document_id:
          type: string
        score:
          type: number
        source_index:
          type: string
  securitySchemes:
    SearchcraftKey:
      type: apiKey
      in: header
      name: Authorization
      description: 'Searchcraft access key passed directly in the Authorization header (no "Bearer" prefix). Keys are tiered by permission: read (search), ingest (document, synonym, stopword, transaction, and measure writes), and admin (index, federation, and key management). Keys may be scoped to specific indexes via allowed_indexes.'