Basic example

The simplest query

Mapping

{
  "id": { "type": "keyword" },
  "name": { "type": "text" }
}

Documents

{
  "documents": [
    { "id": "1", "name": "William Shakespeare" },
    { "id": "2", "name": "Jane Austen" },
    { "id": "3", "name": "Leo Tolstoy" },
    { "id": "4", "name": "Charles Dickens" },
    { "id": "5", "name": "Ernest Hemingway" },
    { "id": "6", "name": "George Orwell" },
    { "id": "7", "name": "Fyodor Dostoevsky" },
    { "id": "8", "name": "Mark Twain" },
    { "id": "9", "name": "J.K. Rowling" },
    { "id": "10", "name": "Stephen King" }
  ]
}

Query configuration

{
  "description": "Authors Query",
  "configuration": {
    "queryFields": {
      "name": 1
    },
    "match": "all",
    "selectFields": ["id", "name"]
  },
  "debugMode": true
}

Public Query

Example 1

Request:

{
  "searchText": "will"
}

Response:

{
  "searchText": "will",
  "total": 1,
  "items": [
    {
      "name": "William Shakespeare",
      "id": "1"
    }
  ],
  "facets": [],
  "filters": {},
  "metadata": {}
}

Example 2

Request:

{
  "searchText": "king"
}

Response:

{
  "searchText": "king",
  "total": 1,
  "items": [
    {
      "name": "Stephen King",
      "id": "10"
    }
  ],
  "facets": [],
  "filters": {},
  "metadata": {}
}