Elasticsearch Query Assistant
The Elasticsearch Query Assistant lets you search with a query written in Elasticsearch's own query language, instead of words in the search bar. Use it when a search needs more than the search bar offers, for example documents that mention one word but not another, or documents of one type created in a particular year.
You do not need to know the query language to use it. Describe what you are looking for to the Query Assistant, and it writes the query for you. Before you run it:
- Check the query does what you asked. The assistant explains the query it wrote. Read the explanation, and change your request if it is not what you meant.
- Check the count under the query. It shows how many documents the query finds before you run it, so you can tell at once if it finds none, or far too many.
Like Search, a query only finds documents you have access to.
What you can do in the Elasticsearch Query Assistant
- Ask the Query Assistant to write a query from a request in your own words
- Go back to an earlier conversation with the assistant
- Write or change a query yourself in the query editor
- See how many documents a query finds before you run it
- Run the query and work with the results as you would in Search
- Preview a result, and go back to the search bar
Raw query mode
To open the Elasticsearch Query Assistant, open Search and click the code icon in the search bar (Switch to raw Elasticsearch query mode). The page changes to three panels.

| Panel | What it is for |
|---|---|
| Query Assistant (left) | Ask for a query in your own words. Your earlier conversations are listed beside it. |
| Elasticsearch Query (JSON) (middle) | The query that runs, with the buttons that run it, clear it, and go back to the search bar. |
| Results (right) | The documents the query found. |
Query Assistant
Type what you are looking for in the prompt and press Enter. The assistant writes a query, puts it in the query editor, and explains in its answer what the query finds. If the query is not what you meant, reply in the same chat to change it. The assistant also works from any change you made to the query yourself.

| Control | What it does |
|---|---|
| New chat | Starts an empty conversation. |
| Chat list (under New chat) | Lists your earlier conversations, each named after your request. Click one to open it again. |
| Model | The AI model that writes the query. Docwize remembers your choice in this browser. |
| Ask about ES queries… | Where you type your request. Press Enter to send it, or Shift+Enter to start a new line. |
| Send (arrow) | Sends your request, in the same way as Enter. |
| Paste an image from clipboard | Paste an image into the prompt to show the assistant what you mean, for example a screenshot of a form. The image is shown above the prompt until you send it or remove it. |
Elasticsearch Query (JSON)
The editor holds the query that Search runs. The assistant writes its queries here, and you can type or paste a query of your own. When you open raw query mode, the editor holds a query that finds all documents.

| Control | What it does |
|---|---|
| Count (under the editor) | Shows how many documents the query finds, for example 2 docs. It updates as you change the query. |
| Search | Runs the query and lists the documents in the results panel. |
| Clear | Empties the editor. |
| Simple Search | Goes back to the search bar. |
When a query cannot be read
A query must be valid JSON. If a bracket, comma or quotation mark is missing, the count is replaced by a message saying what Docwize expected and where, and Search is unavailable until you correct it.

Results
The results panel lists the documents the query found, in the same grid as Search. You can sort, filter, export and assign them in the same way. See Search for the results grid.
Click a result's preview icon to read the document. Click the X at the top left of the preview to close it and go back to the results.

How to build a query with the Query Assistant
| Step | Description |
|---|---|
| 1 | Open Search and click the code icon in the search bar. |
| 2 | Click New chat. |
| 3 | Type what you are looking for in Ask about ES queries…, for example Find documents whose content mentions Quillmarsh, and press Enter. |
| 4 | Read the assistant's answer and the count under the query. If the query is not what you meant, reply in the same chat to change it. |
| 5 | Click Search. The documents are listed in the results panel. |
Example: Building a query with the Query Assistant and running it
How to write a query yourself
| Step | Description |
|---|---|
| 1 | Open Search and click the code icon in the search bar. |
| 2 | Click in the Elasticsearch Query (JSON) editor and type or paste your query. To start again, click Clear. |
| 3 | Check the count under the editor. If a message is shown instead, correct the JSON. |
| 4 | Click Search. |
How to go back to an earlier query
| Step | Description |
|---|---|
| 1 | In the chat list under New chat, click the conversation. |
| 2 | Read the conversation, and reply to change the query if you need to. |
| 3 | Click Search to run the query in the editor. |
How to go back to the search bar
| Step | Description |
|---|---|
| 1 | Click Simple Search. The results of your last query stay on the page. |
| 2 | Click the back arrow at the left of the results toolbar. The Content Search bar is shown again. |