> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get query results (DSL mode)

> Send a query to a query pipeline, using Fusion's Domain Specific Language (DSL).  The response contains matching documents, plus statistics about the query operation.

Use the `/api/query-pipelines` endpoint to get the query pipeline ID for this request.



## OpenAPI

````yaml /api-reference/5.9/fusion-api-query.json post /query-pipelines/{id}
openapi: 3.0.1
info:
  title: Fusion Query API
  description: >-
    A Lucidworks Fusion microservice for machine-learning-enhanced ranking and
    retrieval.
  contact:
    name: Lucidworks
    url: www.lucidworks.com
    email: support@lucidworks.com
  license:
    name: License of API
    url: https://lucidworks.com/legal/developer-license-agreement/
  version: '5.9'
servers:
  - url: https://{FUSION HOST}/api
    description: Fusion
    variables:
      FUSION HOST:
        default: FUSION_HOST
        description: Your environment host.
  - url: https://{FUSION HOST}/api/apps/{APP_NAME}
    description: Fusion app
    variables:
      FUSION HOST:
        default: FUSION_HOST
        description: Your environment host.
      APP_NAME:
        default: APP_NAME
        description: The name of your Fusion app.
security:
  - Basic auth: []
  - API key: []
tags:
  - name: Custom Rule Type API
    description: Endpoints to define and manage custom rule type definitions.
  - name: Experiments API
    description: >-
      Use the Experiments API to compare different configuration variants and
      determine which ones are most successful.
  - name: Query Pipelines API
    description: >-
      Use these endpoints to view and manage your query pipelines.  You can also
      send queries using this API, though the Query Profiles API is recommended
      instead.
  - name: Query Profiles API
    description: >-
      The Query Profiles API provides static endpoints that you can consistently
      point to when querying your collections.  Query profiles allow you to
      change the query pipelines or collections behind them without changing the
      endpoint you use for your search queries.  See the Query Profiles CRUD API
      for endpoints that create and modify query profiles.
  - name: Query Profiles CRUD API
    description: >-
      Use these endpoints to create and modify query profiles.  Query profiles
      allow you to change the query pipelines or collections behind them without
      changing the endpoint you use for your search queries.  See the Query
      Profiles API for the query endpoints.
  - name: Query Rewrite API
    description: >-
      The Query Rewrite API manages documents used for query rewriting to
      improve relevancy using AI-generated data. Primarily for internal use.
  - name: Query Stage API
    description: >-
      Use these endpoints to view the available query pipeline stages and their
      configuration parameters.
  - name: Query Stage Plugins API
    description: >-
      Use these endpoints to view, install, and manage custom query stages
      developed with the Query Stage SDK.
  - name: Signal Indexing API
    description: Endpoints to index signals.
  - name: Experience Manager API
    description: API only for internal use by the Experience Manager Springboard system
  - name: Query Pipeline Template API
    description: Used internally to generate query pipelines from a template.
externalDocs:
  description: Lucidworks Documentation.
  url: https://doc.lucidworks.com/
paths:
  /query-pipelines/{id}:
    post:
      tags:
        - Query Pipelines API
      summary: Get query results (DSL mode)
      description: >-
        Send a query to a query pipeline, using Fusion's Domain Specific
        Language (DSL).  The response contains matching documents, plus
        statistics about the query operation.


        Use the `/api/query-pipelines` endpoint to get the query pipeline ID for
        this request.
      operationId: queryWithDSL
      parameters:
        - name: id
          description: The query pipeline ID.
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DslRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DslResponseWrapper'
components:
  schemas:
    DslRequest:
      type: object
      properties:
        queryDefinition:
          $ref: '#/components/schemas/QueryDefinition'
        results:
          $ref: '#/components/schemas/Results'
        params:
          description: >-
            Arbitrary query parameters to be added to the underlying Solr query,
            also used to supply Security Trimming Stage parameters.
          type: object
          additionalProperties:
            type: object
        context:
          description: Parameters used by various query stages as well as DSL hints.
          type: object
          additionalProperties:
            type: object
        facets:
          $ref: '#/components/schemas/Facets'
    DslResponseWrapper:
      type: object
      properties:
        meta:
          $ref: '#/components/schemas/Meta'
        facets:
          $ref: '#/components/schemas/Facets'
        results:
          $ref: '#/components/schemas/Results'
        spellcheck:
          $ref: '#/components/schemas/Spellcheck'
        debugResponse:
          type: object
          additionalProperties:
            type: object
        rules:
          $ref: '#/components/schemas/Rules'
    QueryDefinition:
      type: object
      description: Defines the logic of what to query for.
      properties:
        main:
          $ref: '#/components/schemas/Query'
        boostsByValues:
          type: array
          items:
            $ref: '#/components/schemas/BoostByValue'
        boostsByQuery:
          type: array
          items:
            $ref: '#/components/schemas/BoostQuery'
        userQuery:
          description: The user query.
          type: string
        filters:
          type: array
          items:
            $ref: '#/components/schemas/Query'
        namedFilters:
          type: array
          items:
            $ref: '#/components/schemas/NamedFilter'
        groupedQuery:
          $ref: '#/components/schemas/Query'
        groupedFilters:
          type: array
          items:
            $ref: '#/components/schemas/Query'
    Results:
      type: object
      description: How the results should be displayed and organized.
      properties:
        cursor:
          description: >-
            * In requests, set this to `*` to use Solr's deep paging.  This is
            analogous to start=0.  Deep paging is the recommended pagination
            method.


            This property is mutually exclusive with `start`; you can use one
            but not both.


            * In responses, this is the cursor position when deep paging is
            used.
          type: string
        start:
          description: >-
            The pagination offset, that is, the number of skipped results for
            pagination.


            This property is mutually exclusive with `cursor`; you can use one
            but not both.
          type: integer
          format: int64
          default: 0
        size:
          description: The number of results per page.
          type: integer
          format: int64
        sort:
          description: The sort field(s) and direction.
          type: array
          items:
            $ref: '#/components/schemas/SortElement'
        fields:
          description: Search result fields.
          type: array
          items:
            type: string
        highlight:
          $ref: '#/components/schemas/Highlight'
        returnScore:
          description: '`true` to include the document scores in search results.'
          type: boolean
        includeRawResponse:
          type: boolean
        group:
          $ref: '#/components/schemas/Group'
    Facets:
      type: object
      description: The returned facets and facet values.
      properties:
        fields:
          description: Fields designated for faceting.
          type: array
          items:
            $ref: '#/components/schemas/FacetField'
        ranges:
          description: Range facets.
          type: array
          items:
            $ref: '#/components/schemas/FacetRange'
        groupFacets:
          description: >-
            `true` to compute grouped facets for the field facets specified in
            `field` parameters. Grouped facets are computed based on the first
            specified group. As with normal field faceting, fields shouldn't be
            tokenized (otherwise counts are computed for each token). Grouped
            faceting supports single and multi-valued fields. Solr's default is
            `false`.
          type: boolean
        groupingMethod:
          type: string
          enum:
            - unique
            - header_doc
    Meta:
      description: Assorted metadata about the query, such as timing and debug information
      type: object
      properties:
        timing:
          $ref: '#/components/schemas/Timing'
        debug:
          $ref: '#/components/schemas/Debug'
    Spellcheck:
      description: Spellcheck results.
      type: object
      properties:
        suggestions:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Suggestion'
        correctlySpelled:
          description: '`true` if no misspellings are detected in the query terms.'
          type: boolean
        collations:
          description: Spellcheck collations for this query.
          type: array
          items:
            $ref: '#/components/schemas/Collation'
    Rules:
      type: object
      description: Data returned by any rules that triggered.
      properties:
        redirects:
          description: URLs returned by redirect rules.
          type: array
          items:
            type: string
        responseValues:
          $ref: '#/components/schemas/ResponseValues'
        banners:
          type: array
          items:
            $ref: '#/components/schemas/Banner'
        jsonBlobs:
          $ref: '#/components/schemas/JsonBlobs'
    Query:
      type: object
      properties:
        type:
          type: string
      discriminator:
        propertyName: type
    BoostByValue:
      type: object
      properties:
        field:
          description: The document field to filter on.
          type: string
        boosts:
          description: A list of `value`/`boost` pairs.
          type: array
          items:
            $ref: '#/components/schemas/KeyAndBoost'
    BoostQuery:
      type: object
      properties:
        query:
          $ref: '#/components/schemas/Query'
        boost:
          description: The numeric boost value.
          type: number
          format: double
        type:
          type: string
    NamedFilter:
      type: object
      properties:
        name:
          description: The filter name.
          type: string
        query:
          $ref: '#/components/schemas/Query'
    SortElement:
      type: object
      properties:
        type:
          type: string
          enum:
            - field
            - expression
            - relevancy
            - query
        value:
          type: string
        order:
          description: The sort order, either ascending (`asc`) or descending (`desc`).
          type: string
          enum:
            - asc
            - desc
        query:
          $ref: '#/components/schemas/Query'
    Highlight:
      description: Highlighting for instances of query terms in search results.
      type: object
      properties:
        fields:
          description: >-
            The fields to use for highlighting. Highlighting should be used for
            text fields only. These fields are typically identified by the `_t`
            suffix, as in `longDescription_t`.
          type: array
          items:
            type: string
        pre:
          description: >-
            The characters immediately preceding a highlighted value. Usually an
            opening HTML tag.
          type: string
          default: <em>
        post:
          description: >-
            The characters immediately following a highlighted value. Usually a
            closing HTML tag.
          type: string
          default: </em>
        length:
          description: The highlight snippet length in characters.
          type: integer
          format: int32
          default: 100
        count:
          description: >-
            The number of highlight snippets to generate for each configured
            field.
          type: integer
          format: int32
          default: 1
        defaultHighlight:
          description: >-
            If no highlight match is found in the field, return the leading part
            of the field instead. Can be used to avoid returning large fields if
            you need to display something even when there is no highlight match.
          type: boolean
          default: false
    Group:
      type: object
      properties:
        field:
          type: string
        leaderStrategy:
          $ref: '#/components/schemas/GroupLeaderStrategy'
        sort:
          type: array
          items:
            $ref: '#/components/schemas/SortElement'
        size:
          type: integer
          format: int64
    FacetField:
      description: A field designated for faceting.
      type: object
      properties:
        field:
          description: The name of the facet field.
          type: string
        prefix:
          description: A Solr facet prefix, for hierarchical faceting.
          type: string
          externalDocs:
            description: See the Solr documentation.
            url: >-
              https://cwiki.apache.org/confluence/display/solr/HierarchicalFaceting
        sort:
          description: |-
            The order in which facet values are listed:

            * `count` ordering is by documents per term, descending.

            * `index` ordering is sorted on term values themselves.
          type: string
          enum:
            - count
            - index
        limit:
          description: The maximum number of terms to be returned.
          type: integer
          format: int32
          default: 100
        offset:
          description: >-
            The number of top facet values to skip in the response (just like
            paging through search results and choosing an offset of 51 to start
            on page 2 when showing 50 results per page).
          type: integer
          format: int32
          default: 0
        minCount:
          description: >-
            The minimum count required for a facet field to be included in the
            response.
          type: integer
          format: int32
        missing:
          description: >-
            The number of documents in the results set which have no value for
            the facet field.
          type: boolean
        ensuredValues:
          type: array
          items:
            type: string
        domain:
          $ref: '#/components/schemas/FacetDomain'
    FacetRange:
      description: Range facets are used for fields that contain date or number values.
      type: object
      properties:
        field:
          description: The field that functions as a range facet field.
          type: string
        start:
          description: The start of the facet range.
          type: string
        end:
          description: The end of the facet range.
          type: string
        gap:
          description: The span of the range as a value to be added to the lower bound.
          type: string
        hardEnd:
          description: >-
            A boolean parameter that specifies how Solr handles a range gap that
            cannot be evenly divided between the range start and end values.


            * If `true`, the last range constraint will have the
            `facet.range.end` value an upper bound.


            * If `false`, the last range will have the smallest possible upper
            bound greater then `facet.range.end` such that the range is the
            exact width of the specified range gap. Solr's default value for
            this parameter is `false`.
          type: boolean
        minCount:
          description: >-
            The minimum count required for a range to be included in the
            response.
          type: integer
          format: int32
        include:
          description: >-
            By default, the ranges used to compute range faceting between
            `start` and `end` are inclusive of their lower bounds and exclusive
            of the upper bounds. The "before" range defined with the `other`
            parameter is exclusive and the "after" range is inclusive. This
            default, equivalent to "lower" below, will not result in double
            counting at the boundaries.


            You can use the `include` parameter to modify this behavior using
            the following options:


            * `lower` - All gap-based ranges include their lower bound.


            * `upper` - All gap-based ranges include their upper bound.


            * `edge` - The first and last gap ranges include their edge bounds
            (lower for the first one, upper for the last one) even if the
            corresponding upper/lower option is not specified.


            * `outer` - The "before" and "after" ranges will be inclusive of
            their bounds, even if the first or last ranges already include those
            boundaries.


            * `all` - Includes all options: lower, upper, edge, outer.
          type: array
          items:
            type: string
            enum:
              - lower
              - upper
              - outer
              - edge
              - all
        other:
          description: >-
            This parameter specifies that, in addition to the counts for each
            range constraint between `start` and `end`, counts should also be
            computed for these options:


            * `before` - All records with field values lower then lower bound of
            the first range.


            * `after` - All records with field values greater then the upper
            bound of the last range.


            * `between` - All records with field values between the start and
            end bounds of all ranges.


            * `none` - Do not compute any counts.


            * `all` - Compute counts for before, between, and after.
          type: array
          items:
            type: string
            enum:
              - before
              - after
              - between
              - non
              - all
        domain:
          $ref: '#/components/schemas/FacetDomain'
    Timing:
      type: object
      properties:
        total:
          type: integer
          format: int64
        mainQuery:
          type: integer
          format: int64
        pipeline:
          type: array
          items:
            $ref: '#/components/schemas/StageTime'
    Debug:
      type: object
      properties:
        solrParams:
          description: Solr parameters for debugging.
          type: object
          additionalProperties:
            type: object
    Suggestion:
      description: A suggested spelling correction for a query term.
      type: object
      properties:
        numFound:
          description: The number of spelling suggestions found for this term.
          type: integer
          format: int32
        startOffset:
          description: The starting offset for pagination.
          type: integer
          format: int32
        endOffset:
          description: The ending offset for pagination.
          type: integer
          format: int32
        origFreq:
          description: >-
            The number of times the original, uncorrected query term appears in
            results.
          type: integer
          format: int32
        suggestion:
          type: array
          items:
            type: object
            properties:
              word:
                description: A suggested spell-corrected word.
                type: string
              freq:
                description: The number of times the suggested word appears in results.
                type: integer
        wordFreqList:
          type: array
          items:
            $ref: '#/components/schemas/WordFreq'
    Collation:
      description: A query correction using collation.
      type: object
      properties:
        collationQuery:
          description: The collated query suggestion.
          type: string
        hits:
          description: The number of documents matching this collated query.
          type: integer
          format: int64
        misspellingsAndCorrections:
          description: The misspelled term and the corrected term.
          type: object
          additionalProperties:
            type: string
    ResponseValues:
      type: object
    Banner:
      description: A banner to include in query responses.
      type: object
      properties:
        url:
          description: URL to a banner, typically an HTML file.
          type: string
        zone:
          description: Zone for the banner in the search UI.
          type: string
    JsonBlobs:
      description: An arbitrary JSON blob returned by a Json Blob rule.
      type: object
    KeyAndBoost:
      type: object
      properties:
        key:
          description: A term used for boosting.
          type: string
        boost:
          description: The numeric boost value.
          type: number
          format: double
          default: 100
    GroupLeaderStrategy:
      type: object
      properties:
        type:
          type: string
      discriminator:
        propertyName: type
    FacetDomain:
      type: object
      properties:
        additionalFilters:
          type: array
          items:
            $ref: '#/components/schemas/Query'
        excludedFiltersByName:
          type: array
          items:
            type: string
    StageTime:
      type: object
      properties:
        stage:
          type: string
        time:
          type: integer
          format: int64
    WordFreq:
      description: A word and its frequency in the query results.
      type: object
      properties:
        word:
          description: A word.
          type: string
        freq:
          description: The word's frequency.
          type: integer
          format: int32
  securitySchemes:
    Basic auth:
      type: http
      scheme: basic
    API key:
      name: x-api-key
      type: apiKey
      in: header

````