API version: dev

---

# Restricting results with minScore

This example reuses the [full text search for "lily"](/reference/search/elasticsearch-query-dsl-mixin/full-text-search.md),
but adds a step parameter `minScore` of `3.0`. Any element whose Elasticsearch relevance score falls below this
threshold is dropped from the result, before the remaining ids are [hydrated](/reference/search/element-hydration.md).

```bash
curl -X POST \
  -H 'Authorization: Bearer secret-token:PIPeJGUt7c00ENn8a5uDlc' \
  -H 'Content-Type: application/json' \
  -d '{
        "debug": true,
        "steps": [
          {
            "type": "elasticsearch-query-dsl-mixin",
            "query": {
              "match": {
                "description": {
                  "query": "lily"
                }
              }
            },
            "parameters": {
              "minScore": 3.0
            }
          },
          {
            "type": "element-hydration"
          }
        ]
      }' \
  https://api.example.com/search
```

##### Response Body

```json
{
  "type": "_SearchResultResponse",
  "results": [
    {
      "type": "Taxon",
      "id": "16884ac8-ba7a-4c91-8449-4fdd803644b6",
      "data": {
        "created": "2025-09-25T18:35:26+00:00",
        "updated": "2025-09-25T18:35:26+00:00",
        "name": "Gloriosa",
        "path": "/Plantae/Tracheophytes/Angiosperms/Monocots/Liliales/Colchicaceae/Gloriosa",
        "scenario": "general.botanicExample",
        "link": "https://en.wikipedia.org/wiki/Gloriosa_(plant)",
        "description": "Gloriosa is a genus of 12 species in the plant family Colchicaceae, and includes the formerly recogn..."
      }
    },
    {
      "type": "Plant",
      "id": "258c0dfe-b1d8-4839-beed-d00d1b544a96",
      "data": {
        "images": [
          {
            "description": "",
            "imageLinkFull": "https://upload.wikimedia.org/wikipedia/commons/f/fe/Flame_lily.png",
            "imageLinkThumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/f/fe/Flame_lily.png/500px-Flame_lily.png",
            "link": "https://en.wikipedia.org/wiki/File:Flame_lily.png"
          },
          {
            "description": "Gloriosa superba at Mabvuku, Harare, Zimbabwe",
            "imageLinkFull": "https://upload.wikimedia.org/wikipedia/commons/b/bc/Gloriosa_superba_1.jpg",
            "imageLinkThumbnail": "https://upload.wikimedia.org/wikipedia/commons/thumb/b/bc/Gloriosa_superba_1.jpg/960px-Gloriosa_supe...",
            "link": "https://en.wikipedia.org/wiki/File:Gloriosa_superba_1.jpg"
          }
        ],
        "created": "2025-09-25T18:35:28+00:00",
        "updated": "2025-09-25T18:35:28+00:00",
        "name": "Flame Lily",
        "scenario": "general.botanicExample",
        "scientificName": "G. superba",
        "link": "https://en.wikipedia.org/wiki/Gloriosa_superba",
        "description": "Gloriosa superba is a species of flowering plant in the family Colchicaceae. Common names include fl..."
      }
    },
    {
      "type": "Taxon",
      "id": "1feedd9f-0c12-490c-8461-b12ff7447ac8",
      "data": {
        "created": "2025-09-25T18:35:26+00:00",
        "updated": "2025-09-25T18:35:26+00:00",
        "name": "Lilieae",
        "path": "/Plantae/Tracheophytes/Angiosperms/Monocots/Liliales/Liliaceae/Lilioideae/Lilieae",
        "scenario": "general.botanicExample",
        "link": "https://en.wikipedia.org/wiki/Lilieae",
        "description": "The Lilieae are a monophyletic tribe of monocotyledon perennial, herbaceous mainly bulbous flowering..."
      }
    },
    "... 5 more items omitted (shapes seen: type:Taxon, type:Plant) ..."
  ],
  "debug": [
    {
      "input": {
        "type": "elasticsearch-query-dsl-mixin",
        "query": {
          "match": {
            "description": {
              "query": "lily"
            }
          }
        },
        "parameters": {
          "minScore": 3,
          "stepResults": []
        }
      },
      "step-handler": "elasticsearch-query-dsl-mixin (App\\EventSystem\\SearchStep\\EventListener\\ElasticsearchQueryDslMixinSe...",
      "start": 1758825391.222043,
      "indices": "*",
      "combinedQuery": {
        "_source": [
          "_id"
        ],
        "from": 0,
        "size": 25,
        "min_score": 3,
        "query": {
          "bool": {
            "must": [
              {
                "match": {
                  "description": {
                    "query": "lily"
                  }
                }
              },
              {
                "bool": {
                  "should": [
                    {
                      "terms": {
                        "_groupsWithSearchAccess.keyword": []
                      }
                    },
                    {
                      "term": {
                        "_usersWithSearchAccess.keyword": {
                          "value": "7baba8b7-a6bb-4184-9a9a-925a4d2736b0"
                        }
                      }
                    }
                  ],
                  "minimum_should_match": 1
                }
              }
            ]
          }
        }
      },
      "end": 1758825391.252388,
      "duration": 0.030345
    },
    {
      "input": {
        "type": "element-hydration",
        "query": null,
        "parameters": {
          "stepResults": [
            {
              "elements": [
                {
                  "id": "16884ac8-ba7a-4c91-8449-4fdd803644b6",
                  "type": "Taxon",
                  "metadata": {
                    "score": 4.5739636
                  }
                },
                {
                  "id": "258c0dfe-b1d8-4839-beed-d00d1b544a96",
                  "type": "Plant",
                  "metadata": {
                    "score": 3.9976888
                  }
                },
                {
                  "id": "1feedd9f-0c12-490c-8461-b12ff7447ac8",
                  "type": "Taxon",
                  "metadata": {
                    "score": 3.7564187
                  }
                },
                "... 5 more items omitted (shapes seen: type:Taxon, type:Plant) ..."
              ],
              "totalHits": 8,
              "maxScore": 4.5739636
            }
          ]
        }
      },
      "step-handler": "element-hydration (App\\EventSystem\\SearchStep\\EventListener\\ElementHydrationSearchStepEventListener)",
      "start": 1758825391.25256,
      "accessibleElementIds": [
        "16884ac8-ba7a-4c91-8449-4fdd803644b6",
        "258c0dfe-b1d8-4839-beed-d00d1b544a96",
        "1feedd9f-0c12-490c-8461-b12ff7447ac8",
        "... 5 more items omitted (shapes seen: string) ..."
      ],
      "end": 1758825391.322722,
      "duration": 0.070162
    }
  ]
}
```

##### Response Headers

```http
Access-Control-Allow-Headers: *
Access-Control-Allow-Methods: GET, HEAD, POST, OPTIONS, PUT, PATCH, DELETE, PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: ETag, Location
Allow: GET, HEAD, POST, OPTIONS, PUT, PATCH, DELETE, PROPFIND, PROPPATCH, MKCOL, COPY, MOVE, LOCK, UNLOCK
Cache-Control: no-cache, private
Content-Type: application/json; charset=utf-8
Date: Thu, 11 Sep 2025 20:23:41 GMT
Transfer-Encoding: chunked
X-Powered-By: Ember Nexus API
```

Compared to the unrestricted full text search - which returned 20 elements with scores ranging from 4.57 down to 1.44 -
this response only contains the 8 elements whose score is at least `3.0`. `minScore` is applied by Elasticsearch itself
via its `min_score` request property, so it affects `totalHits` as well: pagination is calculated only over the
elements that pass the threshold.

**Note**: `minScore` compares against Elasticsearch's raw relevance score, which depends on the query type and the
current state of the index. It is not a normalized percentage, so a useful threshold usually needs to be found through
experimentation. It defaults to `null`, i.e. no filtering.

---

Home: [Ember Nexus API docs](/index.md)

Full site map: [llms.txt](/llms.txt)

Previous: [Range queries on numeric fields](/reference/search/elasticsearch-query-dsl-mixin/range-queries-on-numeric-fields.md)

Next: [Query string](/reference/search/elasticsearch-query-dsl-mixin/query-string.md)
