Search by Using Elasticsearch Query DSL

Running direct Elasticsearch Query Domain Specific Language (DSL) searches in the TDP user interface can help you test your search syntax before applying it programmatically in another system.

There are two ways to run direct Query DSL queries on the Search Files page:

  • The Label & Advanced Filters menu
  • The Search bar

πŸ“˜

NOTE

To run searches programmatically, see Search files via Elasticsearch Query Language in the TetraScience API documentation.

For more information about Query DSL best practices, see Query DSL in the Elasticsearch documentation.

Run a Query DSL Query by Using the Label & Advanced Filters Menu

To run a direct Query DSL query by using the Label & Advanced Filters menu, do the following:

  1. Open the Search Files page.
  2. Choose Label & Advanced Filters. A dialog appears that includes filter options as different tabs.
  3. Select the Raw EQL tab. The Search files via Elasticsearch Query Language endpoint (/searchEql) request displays.
  4. Edit the query as needed for your use case. (See the Elasticsearch Query DSL Example)
  5. (Optional) To run the query without validating the query structure, select the No validation check box.
  6. Choose Run EQL. The query runs and displays the Response.

🚧

IMPORTANT

To search for a specific file path use the filePath field. To search for a part of the file path, use the enhancedSearchContext.filePathParts field. This field allows you to target specific tokens in the file path. Don’t use a wildcard prefix (*). Queries that include wildcards aren’t as effective, take longer to run, and require more computing resources. For more information, see Wildcard Searches.

Elasticsearch Query DSL Example

πŸ“˜

NOTE

This example query includes the following variables:

  • Example files that have the following filePath value: chromeleon/ChromeleonLocal/MYUSER/HPLC_Run_20230817_myuser.seq
  • Query parameters that specify that the file path must match the the following values: hplc, myuser, and 20230817
GET /your_index/_search
{
  "size": 100,
  "_source": {
      "includes": ["filePath", "fileId", "category", "createdAt", "labels"]
  },
  "query": {
    "bool": {
      "must": [
        { "match": { "enhancedSearchContext.filePathParts": "hplc" } },
        { "match": { "enhancedSearchContext.filePathParts": "myuser" } },
        { "match": { "enhancedSearchContext.filePathParts": "20230817" } }
      ]
    }
  }
}

Important Considerations

When creating Elasticsearch Query DSL queries, keep in mind the following:

  • Search terms must be specified in lowercase, unless you want to target an exact match for a term. To target an exact match for a search term, place the term in quotes (for example, "My Specifically Cased Phrase").
  • It’s a best practice to specify a size field and a _source field to limit the amount of data returned from the Data Lake.
  • For programmatic use cases, make sure that you use pagination features and target only the information you need.

Run a Query DSL Query by Using the Search Bar

πŸ“˜

NOTE

The Search bar uses the Elasticsearch query_string query, which parses the input and splits text around operators. Each textual part is analyzed independently of each other.

To run a query using the Search bar, do the following:

  1. Open the Search Files page.
  2. In the Search bar, enter either parts of a file path (separated by spaces), or a complete file path. Don’t use wildcard searches.
  3. Choose Search. Files that match the search criteria you entered display as results in the file list. Results are sorted by relevance instead of by upload date by default.

πŸ“˜

NOTE

Search results that include Intermediate Data Schema (IDS) output files also return the associated RAW input files.