> For the complete documentation index, see [llms.txt](https://documentation.ocsinventory-ng.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.ocsinventory-ng.org/user-docs/console-tools/multi-criteria-search.md).

# Multi-criteria search

Multi-criteria search lets you build **structured queries** across OCS data. Use it when the global search bar is not enough or when you need **AND / OR logic**.

{% hint style="info" %}
If you run the same query often, save it. See [Saved searches](https://documentation.ocsinventory-ng.org/user-docs/console-tools/saved-searches.md).
{% endhint %}

## Basic search

<figure><img src="https://461838061-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtjrEC8kt8LJiJYFBs5CS%2Fuploads%2FfQMt5obALIIQTVBNdWXA%2Fimage_2026-05-11_105539625.png?alt=media&amp;token=b82a3b83-7fad-4615-be08-28ad5e5aa575" alt="Example of a basic multi-criteria search"><figcaption><p>Example of a basic multi-criteria search</p></figcaption></figure>

Goal: find assets where **OS Name** contains `windows` and **OS Version** starts with `10`.

### Create the first criterion

{% stepper %}
{% step %}
Navigate to **Inventory → Tools → Multi-criteria search**.
{% endstep %}

{% step %}
Define the first criterion.

* Using the first drop-down, select **Assets**.
* For the second drop-down, choose **OS Name**.
* In the third drop-down, select **contains**.
* In the value field, enter `windows`.
  {% endstep %}

{% step %}
Click **Search**.
{% endstep %}

{% step %}
Check the results.
{% endstep %}
{% endstepper %}

### Add a second criterion

{% stepper %}
{% step %}
Add a criterion line.

Click the **+** button at the end of the first criteria line.

A new line appears. You also get a logical operator (**AND** / **OR**).
{% endstep %}

{% step %}
Define the second criterion.

* Set the logical operator to **AND**.
* Use the drop-downs to construct your second criterion:
  * For the first drop-down, select **Assets**.
  * For the second drop-down, choose **OS Version**.
  * For the third drop-down, select **starts with**.
  * In the value field, enter `10`.
    {% endstep %}

{% step %}
Run the search.

Click **Search**.
{% endstep %}

{% step %}
Review the results.

Matching assets appear in the results table.
{% endstep %}
{% endstepper %}

## Advanced search: groups

Groups let you control precedence. They work like parentheses in SQL.

Each group contains its own criteria lines. Groups are combined with **AND** or **OR**.

<figure><img src="https://461838061-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtjrEC8kt8LJiJYFBs5CS%2Fuploads%2FAZPU0GiXVeiz4nPSyTRm%2Fimage.png?alt=media&amp;token=4c6516f7-4378-4ba2-8bea-68a3c432f78d" alt="Advanced search example"><figcaption><p>Advanced search example</p></figcaption></figure>

{% stepper %}
{% step %}
Build the first group.

Start from a working basic search. Keep at least one criteria line in the default group.
{% endstep %}

{% step %}
Click **Add a search group**.
{% endstep %}

{% step %}
Choose how groups are combined.

On the first line of the new group, pick **AND** or **OR**. This operator links the whole group to the previous one.
{% endstep %}

{% step %}
Define criteria inside the new group.
{% endstep %}

{% step %}
Click **Search**.
{% endstep %}
{% endstepper %}

## Grouping results

The **Group results** checkbox under the search button is checked by default. It keeps your results grouped.

* If you keep **Group results** enabled, only one result per asset appears, even if multiple entries for a device match the query. For more detail, click **View more results** in the Actions column.
* If you disable **Group results**, each matching entry appears.

{% hint style="warning" %}
Be aware that ungrouping results might affect search performance.
{% endhint %}

## Example queries

{% tabs %}
{% tab title="Software update campaign" %}

* Assets → **OS Name** contains `Windows`
* AND Software → **Name** contains `Software X`
* AND Software → **Major** is greater than or equal to `2`
  {% endtab %}

{% tab title="Windows conformity" %}

* Assets → **OS Name** contains `Windows`
* AND Assets → **OS Version** starts with `11`
* AND Template → **Build** is greater than or equal to `XXX`
* AND Software → **Name** is `.NET`
  {% endtab %}

{% tab title="Linux server conformity" %}

* Group 1
  * Assets → **OS Name** contains `RHEL`
  * AND Assets → **OS Version** starts with `9`
* OR Group 2
  * Assets → **OS Name** contains `Debian`
  * AND Assets → **OS Version** starts with `13`
* AND Software → **Name** contains `package-x`
* AND Software → **Major** is greater than or equal to `X`
* AND Administrative data → **Environment** contains `Production`
  {% endtab %}
  {% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://documentation.ocsinventory-ng.org/user-docs/console-tools/multi-criteria-search.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
