API version: 0.3.0

---

# Full text search

This example uses Elasticsearch's [`match` query](https://www.elastic.co/docs/reference/query-languages/query-dsl/query-dsl-match-query)
to perform a full text search of the word "lily" against the property `description` of all elements accessible to the
user.\
Results are then [hydrated](/reference/search/element-hydration.md), i.e. transformed into a collection response.

```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"
                }
              }
            }
          },
          {
            "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:16:05+00:00",
        "updatedAt": "2026-12-05T12:16:05+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:16:05+00:00",
        "updatedAt": "2026-12-05T12:16:05+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:16:01+00:00",
        "updatedAt": "2026-12-05T12:16:01+00:00"
      },
      "metadata": {
        "score": 3.7523305
      }
    },
    "... 17 more items omitted (shapes seen: type:Taxon, type:Plant) ..."
  ],
  "debug": [
    {
      "input": {
        "type": "elasticsearch-query-dsl-mixin",
        "query": {
          "match": {
            "description": {
              "query": "lily"
            }
          }
        },
        "parameters": {
          "stepResults": []
        }
      },
      "step-handler": "elasticsearch-query-dsl-mixin (App\\EventSystem\\SearchStep\\EventListener\\ElasticsearchQueryDslMixinSe...",
      "start": 1796473118.512843,
      "indices": "*",
      "combinedQuery": {
        "_source": [
          "_id"
        ],
        "from": 0,
        "size": 25,
        "query": {
          "bool": {
            "must": [
              {
                "match": {
                  "description": {
                    "query": "lily"
                  }
                }
              }
            ],
            "filter": [
              {
                "bool": {
                  "should": [
                    {
                      "terms": {
                        "_groupsWithSearchAccess.keyword": []
                      }
                    },
                    {
                      "term": {
                        "_usersWithSearchAccess.keyword": {
                          "value": "02IiNr0GOoKiPMM5A0eq9jHk2upaJezsVtWjL"
                        }
                      }
                    }
                  ],
                  "minimum_should_match": 1
                }
              }
            ]
          }
        }
      },
      "end": 1796473118.522505,
      "duration": 0.009662
    },
    {
      "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
                  }
                },
                "... 17 more items omitted (shapes seen: type:Taxon, type:Plant) ..."
              ],
              "totalHits": 20,
              "maxScore": 4.5698752
            }
          ]
        }
      },
      "step-handler": "element-hydration (App\\EventSystem\\SearchStep\\EventListener\\ElementHydrationSearchStepEventListener)",
      "start": 1796473118.522813,
      "accessibleElementIds": [
        "02IiNr0GOoKiPMLHurXARbcQUHxEJVbY9UJPL",
        "02IiNr0GOoKiPMLPDlPbKrlR4vnBQsvSBSkU5",
        "02IiNr0GOoKiPMLMTxO45AnoTbb6AIdILXae9",
        "... 17 more items omitted (shapes seen: string) ..."
      ],
      "end": 1796473118.564486,
      "duration": 0.041673
    }
  ]
}
```

##### Response Headers

```http
Access-Control-Allow-Headers: Authorization, Content-Type, Prefer
Access-Control-Allow-Methods: OPTIONS, POST
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Preference-Applied
Allow: OPTIONS, POST
Cache-Control: no-cache, private
Content-Type: application/json; charset=utf-8
Date: Thu, 03 Dec 2026 12:24:50 GMT
Transfer-Encoding: chunked
Vary: Prefer, Accept-Encoding
X-Powered-By: Ember Nexus API
```

Every result contains the term "lily" somewhere in its description, including plants that are not lilies botanically -
Magnolia ("lilytree"), Daffodil ("Lent lily"), Desert Rose ("impala lily"). The Debug tab shows the relevance score of
each element; results are ordered by it, from 4.57 down to 1.44.

---

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

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

Previous: [Elasticsearch query](/reference/search/elasticsearch-query-dsl-mixin.md)

Next: [Exact keyword matching](/reference/search/elasticsearch-query-dsl-mixin/exact-keyword-matching.md)
