API version: 0.3.0

---

# 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": "02IiNr0GOoKiPMLHurXARbcQUHxEJVbY9UJPL",
      "data": {
        "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...",
        "createdAt": "2026-12-05T12:21:40+00:00",
        "updatedAt": "2026-12-05T12:21:40+00:00"
      },
      "metadata": {
        "score": 4.5698752
      }
    },
    {
      "type": "Plant",
      "id": "02IiNr0GOoKiPMLPDlPbKrlR4vnBQsvSBSkU5",
      "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"
          }
        ],
        "hasFile": true,
        "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...",
        "createdAt": "2026-12-05T12:21:40+00:00",
        "updatedAt": "2026-12-05T12:21:40+00:00"
      },
      "file": {
        "contentLength": 90681,
        "extension": "jpg",
        "mimeType": "image/jpeg",
        "hash": {
          "sha256": "72e3e3770db795b2f04f0b5bb0be43e74df70de4faa0bf83a706bbde29e4ea0b"
        }
      },
      "metadata": {
        "score": 4.001134
      }
    },
    {
      "type": "Taxon",
      "id": "02IiNr0GOoKiPMLMTxO45AnoTbb6AIdILXae9",
      "data": {
        "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...",
        "createdAt": "2026-12-05T12:21:37+00:00",
        "updatedAt": "2026-12-05T12:21:37+00:00"
      },
      "metadata": {
        "score": 3.7523305
      }
    },
    "... 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": 1796473377.076012,
      "indices": "*",
      "combinedQuery": {
        "_source": [
          "_id"
        ],
        "from": 0,
        "size": 25,
        "min_score": 3,
        "query": {
          "bool": {
            "must": [
              {
                "match": {
                  "description": {
                    "query": "lily"
                  }
                }
              }
            ],
            "filter": [
              {
                "bool": {
                  "should": [
                    {
                      "terms": {
                        "_groupsWithSearchAccess.keyword": []
                      }
                    },
                    {
                      "term": {
                        "_usersWithSearchAccess.keyword": {
                          "value": "02IiNr0GOoKiPMM5A0eq9jHk2upaJezsVtWjL"
                        }
                      }
                    }
                  ],
                  "minimum_should_match": 1
                }
              }
            ]
          }
        }
      },
      "end": 1796473377.086185,
      "duration": 0.010173
    },
    {
      "input": {
        "type": "element-hydration",
        "query": null,
        "parameters": {
          "stepResults": [
            {
              "elements": [
                {
                  "id": "02IiNr0GOoKiPMLHurXARbcQUHxEJVbY9UJPL",
                  "type": "Taxon",
                  "metadata": {
                    "score": 4.5698752
                  }
                },
                {
                  "id": "02IiNr0GOoKiPMLPDlPbKrlR4vnBQsvSBSkU5",
                  "type": "Plant",
                  "metadata": {
                    "score": 4.001134
                  }
                },
                {
                  "id": "02IiNr0GOoKiPMLMTxO45AnoTbb6AIdILXae9",
                  "type": "Taxon",
                  "metadata": {
                    "score": 3.7523305
                  }
                },
                "... 5 more items omitted (shapes seen: type:Taxon, type:Plant) ..."
              ],
              "totalHits": 8,
              "maxScore": 4.5698752
            }
          ]
        }
      },
      "step-handler": "element-hydration (App\\EventSystem\\SearchStep\\EventListener\\ElementHydrationSearchStepEventListener)",
      "start": 1796473377.086492,
      "accessibleElementIds": [
        "02IiNr0GOoKiPMLHurXARbcQUHxEJVbY9UJPL",
        "02IiNr0GOoKiPMLPDlPbKrlR4vnBQsvSBSkU5",
        "02IiNr0GOoKiPMLMTxO45AnoTbb6AIdILXae9",
        "... 5 more items omitted (shapes seen: string) ..."
      ],
      "end": 1796473377.112533,
      "duration": 0.026041
    }
  ]
}
```

##### Response Headers

```http
Access-Control-Allow-Headers: *
Access-Control-Allow-Methods: OPTIONS, POST
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: ETag, Location
Allow: OPTIONS, POST
Cache-Control: no-cache, private
Content-Type: application/json; charset=utf-8
Date: Sat, 21 Nov 2026 10:43:13 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)
