# Using search in Cortex

## Searching your data in Cortex

Cortex has two options for searching across your data:

* The [search bar at the top of any catalog](#using-the-catalog-search-bar)
  * Click the magnifying glass in the upper right corner of a list to open the search bar.\\

    <figure><img src="https://826863033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJW7pYRxS4dHS3Hv6wxve%2Fuploads%2Fgit-blob-977bd95567dc036adea9fa7a6ada99b8f5a048c1%2Fopen-search-bar.jpg?alt=media" alt=""><figcaption></figcaption></figure>
  * This search uses Lucene for the search index. See the [available operators](#search-index-and-operators) below.
* The [global search](#using-global-search-in-cortex) at the top of the main nav
  * The global search allows you to conduct a quick search from anywhere in Cortex, and it searches across names, descriptions, and tags.

### Using the catalog search bar

When you need to find a specific entity in Cortex, use the search bar at the top of any catalog:

1. Click the magnifying glass in the upper right corner.\\

   <figure><img src="https://826863033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJW7pYRxS4dHS3Hv6wxve%2Fuploads%2Fgit-blob-977bd95567dc036adea9fa7a6ada99b8f5a048c1%2Fopen-search-bar.jpg?alt=media" alt=""><figcaption></figcaption></figure>
2. Enter text into the search bar.
   * You can use plain text for a basic search, or use operators to refine your search.

{% hint style="info" %}
Searches prepend and append a [wildcard](https://lucene.apache.org/core/3_6_0/queryparsersyntax.html#Wildcard%20Searches) to your search. For example, searching for "search doc" would be translated into `*search doc*` under the hood.
{% endhint %}

## Search index and operators

Cortex uses Lucene for the search index, so queries must follow [Lucene syntax](https://lucene.apache.org/core/3_6_0/queryparsersyntax.html).

If you search for a term that includes Lucene syntax characters, such as `:`, try wrapping your search term in double quotes.

Below is a chart of Cortex's search index and available operators. The search fields are listed in order of weight, with `title`, `tag` and `CID` carrying the most weight and `repo basepath`, `links`, and `custom data` carrying the least weight.

<table><thead><tr><th>Search field</th><th>Corresponding YAML field</th><th width="183.5576171875">Explanation</th><th>Examples (based on sample YAMLs below)</th></tr></thead><tbody><tr><td><strong>Title</strong> (<code>title:</code> or <code>name:</code>)</td><td><code>title</code></td><td>Searches for the entity's name as defined in the <code>title</code> field.</td><td><ul><li>search doc</li><li>search</li><li>title:"search doc"</li><li>name:"search doc"</li></ul></td></tr><tr><td><strong>Tag</strong> (<code>tag:</code>)</td><td><code>x-cortex-tag</code></td><td>Searches for a <a href="../../../ingesting-data-into-cortex/entities#cortex-tag">Cortex tag</a> as defined in the <code>x-cortex-tag</code> field. If a tag has more than one term separated by a hyphen, you can search for the tag using hyphens or spaces. At least one of these (or a wildcard) must be used for results to be generated.</td><td><ul><li>search-doc</li><li>search</li><li>tag:"search-doc"</li><li>tag:"search"</li></ul></td></tr><tr><td><strong>CID</strong> (<code>cid:</code>)</td><td>(depends on integration)</td><td>Searches for an ID associated with an entity. This usually comes from a third-party integration.</td><td><ul><li>ASDF1234</li><li>cid:"ASDF1234"</li></ul></td></tr><tr><td><strong>Description</strong> (<code>description:</code>)</td><td><code>description</code></td><td>Searches for the supplied term(s) in an entity's description.</td><td><ul><li>example entity</li><li>article search example</li><li>description:"article"</li><li>description:"using search"</li></ul></td></tr><tr><td><strong>Group</strong> (<code>group:</code>)</td><td><code>x-cortex-groups</code></td><td>Searches for entity group names.</td><td><ul><li>docs</li><li>writing</li><li>group:"writing-project"</li><li>group:"docs"</li></ul></td></tr><tr><td><strong>Owner</strong> (<code>owner:</code>)</td><td><code>x-cortex-owners</code></td><td>Searches for the owner(s) of an entity. If the owner is a team, Cortex searches team names and team members' names and email addresses. If the owner is an individual, Cortex searches for the user email.</td><td><ul><li>technical writers</li><li>sample.user</li><li>owner:"sample"</li><li>owner:"technical"</li></ul></td></tr><tr><td><strong>Member</strong> (<code>member:</code>)</td><td><code>x-cortex-team</code>, <code>members</code></td><td>Searches for the name and email address for a team member. This query only returns Team entities.</td><td><ul><li>additional user</li><li>additional.user</li><li>member:"additional"</li><li>member:"user"</li></ul></td></tr><tr><td><strong>Slack channel</strong> (<code>slack:</code>)</td><td><code>x-cortex-slack</code></td><td>Searches for a Slack channel name defined in the <code>x-cortex-slack</code> field.</td><td><ul><li>frontal-lobe</li><li>left-brain</li><li>slack:"frontal"</li><li>slack:"left"</li></ul></td></tr><tr><td><strong>Microsoft Teams channel</strong> (<code>microsoft-team:</code>)</td><td><code>x-cortex-microsoft-teams</code></td><td>Searches for a Microsoft Teams channel name defined in the <code>x-cortex-microsoft-teams</code> field.</td><td><ul><li>team-docs</li><li>documentation</li><li>microsoft-team:"team-docs"</li><li>microsoft-team:"documentation"</li></ul></td></tr><tr><td><strong>Repository</strong> (<code>repo:</code> or <code>repository:</code>)</td><td><code>x-cortex-git</code>, <code>repository</code></td><td>Searches for a Git repository name.</td><td><ul><li>cortex/docs</li><li>docs</li><li>repo:"docs"</li><li>repo:"cortex/docs"</li></ul></td></tr><tr><td><strong>Repo basepath</strong> (<code>repo-basepath:</code> or <code>repository-basepath:</code> )</td><td><code>x-cortex-git</code>, <code>basepath</code></td><td>Searches for a Git repo basepath name.</td><td><ul><li>myEntity</li><li>repo-basepath:"myEntity"</li></ul></td></tr><tr><td><strong>Link</strong> (<code>link:</code>)</td><td><code>x-cortex-link</code></td><td>Searches for link based on <code>name</code> and <code>URL</code> defined under <code>x-cortex-link</code>.</td><td><ul><li>docs.cortex.io</li><li>live docs</li><li>link:"live"</li><li>link:"docs.cortex"</li></ul></td></tr><tr><td><strong>Custom data</strong> (<code>key</code>:<code>value</code>)</td><td><code>x-cortex-custom-metadata</code></td><td>Searches for custom data imported from APIs, third-party integrations, and/or defined in the <code>x-cortex-metadata</code> block.</td><td><ul><li>regions-of-brain:cerebrum<br></li></ul><p>The key is case-sensitive.</p></td></tr><tr><td><strong>AWS account ID</strong> (<code>aws-account-id:</code>)</td><td>Defined in AWS, not in an entity's YAML</td><td>Searches for the AWS account ID of an entity.</td><td><ul><li>aws-account-id:"012345678901"</li></ul></td></tr><tr><td><strong>AWS account name</strong> (<code>aws-account-name:</code>)</td><td>Defined in AWS, not in an entity's YAML</td><td>Searches for entities with an AWS account name.</td><td><ul><li>aws-account-name:"example-aws-account"</li></ul></td></tr><tr><td><strong>AWS region</strong> (<code>aws-region:</code>)</td><td>Defined in AWS, not in an entity's YAML</td><td>Searches for entities in an AWS region.</td><td><ul><li>aws-region:"us-west-1"</li></ul></td></tr><tr><td><strong>AWS ARN</strong> (<code>aws-arn:</code>)</td><td>Defined in AWS, not in an entity's YAML</td><td>Searches for an Amazon Resource Name (ARN). This is not supported for Cloud Control types.</td><td><ul><li>aws-arn:"arn:aws:iam::123456789012:user/johndoe"</li></ul></td></tr><tr><td><strong>AWS entity type</strong> (<code>aws-type:</code>)</td><td>Defined in AWS, not in an entity's YAML</td><td>Searches for entities of a given AWS entity type.</td><td><ul><li>aws-type:"lambda"</li></ul></td></tr><tr><td><strong>AWS entity name</strong> (<code>aws-name:</code>)</td><td>Defined in AWS, not in an entity's YAML</td><td>Searches for an AWS entity name.</td><td><ul><li>aws-name:"abc-lambda"</li></ul></td></tr><tr><td><strong>AWS primary identifier</strong> (<code>aws-identifier:</code>)</td><td>Defined in AWS, not in an entity's YAML</td><td>Searches for an AWS primary identifier.</td><td><ul><li>aws-identifier: "value"</li></ul></td></tr><tr><td><strong>AWS secondary identifier</strong> (<code>aws-secondary-identifier:</code>)</td><td>Defined in AWS, not in an entity's YAML</td><td>Searches for an AWS secondary identifier.</td><td><ul><li>aws-secondary-identifier: "value"</li></ul></td></tr></tbody></table>

### Example YAML files

The YAML files below show what an entity might look like based on the examples in the table above:

#### Search doc entity YAML

```yaml
info:
  title: Search doc
  description: Example entity for an article about using search in Cortex.
  x-cortex-tag: search-doc
  x-cortex-type: service
  x-cortex-groups:
    - writing-project
    - docs
  x-cortex-git:
    github:
      repository: cortex/docs
      basepath: myEntity
  x-cortex-link:
    - url: https://docs.cortex.io/
      name: Live docs
      type: DOCUMENTATION
  x-cortex-owners:
    - name: technical-writers
      type: GROUP
      provider: CORTEX
    - type: EMAIL
      email: sample.user@fake.com
  x-cortex-oncall:
    pagerduty:
      id: ASDF1234
      type: SERVICE
  x-cortex-slack:
    channels:
      - name: frontal-lobe
        notificationsEnabled: true
      - name: left-brain
        notificationsEnabled: true
  x-cortex-microsoft-teams:
    channels:
    - name: team-docs
      teamName: documentation
      description: This is a description for the docs channel in Teams.
      notificationsEnabled: true
  x-cortex-metadata:
    regions-of-brain: cerebrum, cerebellum
```

#### Technical writers team YAML

```yaml
info:
  title: Technical writers
  description: Example Team behind the article about using search in Cortex.
  x-cortex-type: team
  x-cortex-tag: technical-writers
  x-cortex-team: 
    groups:
      - name: cortex/technical-writers
        provider: GITHUB
    members:
      - name: Additional User
        email: additional.user@example.com
        notificationsEnabled: true
```

{% hint style="info" %}
An entity's title, tag, and ID have carry the greatest weight in a search.
{% endhint %}

## Search AWS details

There are additional keys available to search Amazon Web Services (AWS) details in Cortex. See [Searching AWS entities in Cortex](https://docs.cortex.io/ingesting-data-into-cortex/integrations/aws#searching-aws-entities-in-cortex) for more information.

## Using global search in Cortex

You can search the Cortex platform from any page using the global search function. Global search pulls from names, descriptions, and tags.

Click Search in the upper left side of Cortex, and a search modal will appear:

<figure><img src="https://826863033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJW7pYRxS4dHS3Hv6wxve%2Fuploads%2Fgit-blob-31e9d17c13eef61c7384acddd67b2289118ee6c7%2Fglobal-search.jpg?alt=media" alt=""><figcaption></figcaption></figure>

You can search across all items, or you can click into tabs to view entities, Initiatives, catalogs, plugins, Scorecards, Workflows, or CQL reports. Click into any item in the search results to navigate to it.

The first 10 results are displayed in the modal. Click **See all** to view additional results.

<figure><img src="https://826863033-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJW7pYRxS4dHS3Hv6wxve%2Fuploads%2Fgit-blob-7280e378e999227fd82402d39753534726fca717%2Fsee-all-search-results.jpg?alt=media" alt=""><figcaption></figcaption></figure>
