Querying an index
Querying an index lets you view the raw search results returned by the search engine, which are formatted in JSON. You can specify the following information when running a query:
- Query String: For information on the query syntax you can use, see Query syntax.
- Query String: For information on the query syntax you can use, see Query syntax.
- Query Settings: Select the query settings to apply to search results. For information on query settings, see Query settings.
- Result Offset: Specify a number of results to skip. To view all results, set this value to 0.
- Result Count to Return: The number of results to return.NoteThis setting has both a maximum return value of 100,000 documents and a 1,000 page limit in the Search results.
- Facets: A list of fields to use as facets. Facets are categories of information about Search results.NoteWhen you query an Apache Solr or HCI index, Solr debugging information is returned as part of the query. This information explains why each item in the Search results was returned in response to your query.
To view this information, click the Info tab after querying an index.
To query an index:
Procedure
Click the Index Collections panel.
Select the index collection you want to query.
Click the Query tab.
Optionally, configure the options in the Query Parameters section. If you want to view all results for the index, leave the default settings.
Click Run Query.
Query syntax
This topic describes the syntax you use when querying an index directly from the REST API, Admin App, or CLI.
To use a field to query the index, you need to configure the field so the indexed field attribute appears in the index collection schema.
For information on:
- Querying an index directly, see Querying an index.
- Configuring fields in an index collection schema, see Adding and editing fields in an index collection schema.
The basic format for a query is field:value.
For example, this expression finds files that have a field called title that has a value called Quarterly Report:
title:"Quarterly Report"
You can use the + and - operators to combine search terms. For example:
+sender:jsmith -recipient:mjones
The query returns files where the sender field is jsmith and the recipient field is not mjones.
This table shows the ways that you can search using multiple values for a single field.
Format | Example | Description |
field:(value value) |
sender:(jsmith mjones) | Returns files where the sender field is either jsmith or mjones . |
field:(+value +value) |
body:(+sales +"Widget Inc") | Returns files where the body field includes both sales and Widget Inc . |
field:(-value -value) |
date:(-august -september) | Returns files where the date field includes neither august nor september . |
field:(+value value -value) |
recipient:(+jsmith mjones -lstewart) | Returns files where the recipient field includes both jsmith and mjones or only jsmith , but not lstewart . |
This table describes the formats you can use to search for a range of values.
Format | Description |
field:[start-value TO end-value] |
Matches files that contain values in the specified range, including the start-value and end-value. For example, this search term returns files where the author's name begins with A, B, C, or D: author:[A* TO D*] |
field:{start-value TO end-value} |
Matches files that contain values in the specified range, excluding the start-value and end-value. For example, this search term returns files where the author's name begins with B or C: author:{A* TO D*} |
This table describes the wildcard characters you can use in your queries.
Character | Description |
? |
Matches a single character. For example, the search term |
* |
Matches any number of consecutive characters, including none. For example, the search term
|
Fuzzy searches return files that contain values similar to, but don't exactly match, the values you specify. To specify a fuzzy search term, insert a tilde (~) after a single-word search term.
For example, the search term red~ returns files that contain the word red, but also files that contain words like bed or beds.
To query for a negative number, enclose the value in double quotation marks ("). For example:
temperature:"−273.15"