* Make API reference top level Signed-off-by: Naarcha-AWS <[email protected]> * Fix typo on Drag and Drop page (#1633) * Fix typo on Drag and Drop page * Update _dashboards/drag-drop-wizard.md Co-authored-by: Nate Bower <[email protected]> * Update drag-drop-wizard.md Co-authored-by: Nate Bower <[email protected]> * Putting all the Docker install material on a single page (#1452) * Putting all the Docker install material on a single page Signed-off-by: JeffH-AWS <[email protected]> * Making room for revamp Signed-off-by: JeffH-AWS <[email protected]> * Intro added Signed-off-by: JeffH-AWS <[email protected]> * Continuing to flesh out the intro section and overview Signed-off-by: JeffH-AWS <[email protected]> * Overview finalized Signed-off-by: JeffH-AWS <[email protected]> * Introducing docker compose Signed-off-by: JeffH-AWS <[email protected]> * Added link to compose Signed-off-by: JeffH-AWS <[email protected]> * Continuing docker image commentary Signed-off-by: JeffH-AWS <[email protected]> * Sometimes I wonder if anyone reads these Signed-off-by: JeffH-AWS <[email protected]> * Adding notes on installing compose with pip Signed-off-by: JeffH-AWS <[email protected]> * Adding prereqs Signed-off-by: JeffH-AWS <[email protected]> * Magnets - how do they work? Signed-off-by: JeffH-AWS <[email protected]> * Almonds and peaches are part of the same plant subgenus, Amygdalus Signed-off-by: JeffH-AWS <[email protected]> * There are 293 ways to make change for a dollar Signed-off-by: JeffH-AWS <[email protected]> * A shark is the only known fish that can blink with both eyes Signed-off-by: JeffH-AWS <[email protected]> * A crocodile cannot stick its tongue out Signed-off-by: JeffH-AWS <[email protected]> * wording Signed-off-by: JeffH-AWS <[email protected]> * Reorganizing a couple paragraphs to make it flow better Signed-off-by: JeffH-AWS <[email protected]> * Forgot a word Signed-off-by: JeffH-AWS <[email protected]> * Add tip about pruning stopped containers Signed-off-by: JeffH-AWS <[email protected]> * Cleaning up Signed-off-by: JeffH-AWS <[email protected]> * Add blurb about container ls Signed-off-by: JeffH-AWS <[email protected]> * Adding the Docker Compose stuff Signed-off-by: JeffH-AWS <[email protected]> * Working on compose Signed-off-by: JeffH-AWS <[email protected]> * Continuing work on the compose section - it's a lot of info Signed-off-by: JeffH-AWS <[email protected]> * Added important settings Signed-off-by: JeffH-AWS <[email protected]> * Updates to settings that need configured Signed-off-by: JeffH-AWS <[email protected]> * Still working through compose things Signed-off-by: JeffH-AWS <[email protected]> * Fixed wording Signed-off-by: JeffH-AWS <[email protected]> * Working through compose commands and guidance Signed-off-by: JeffH-AWS <[email protected]> * Reordering/rewording Signed-off-by: JeffH-AWS <[email protected]> * More phrasing Signed-off-by: JeffH-AWS <[email protected]> * More wording in steps Signed-off-by: JeffH-AWS <[email protected]> * More wording in steps Signed-off-by: JeffH-AWS <[email protected]> * Organizing Signed-off-by: JeffH-AWS <[email protected]> * Adding stuff and things Signed-off-by: JeffH-AWS <[email protected]> * Continuing to work through the configuration steps Signed-off-by: JeffH-AWS <[email protected]> * Fixes Signed-off-by: JeffH-AWS <[email protected]> * Fixes Signed-off-by: JeffH-AWS <[email protected]> * Still working on the configuration steps Signed-off-by: JeffH-AWS <[email protected]> * Changes Signed-off-by: JeffH-AWS <[email protected]> * More work Signed-off-by: JeffH-AWS <[email protected]> * Removed perf analyzer - refer to GH issue 1555 Signed-off-by: JeffH-AWS <[email protected]> * Fixing things Signed-off-by: JeffH-AWS <[email protected]> * Adding guidance on passing settings in compose Signed-off-by: JeffH-AWS <[email protected]> * Working through dockerfile materials now Signed-off-by: JeffH-AWS <[email protected]> * wording Signed-off-by: JeffH-AWS <[email protected]> * Finalized the sample dev compose file Signed-off-by: JeffH-AWS <[email protected]> * Continuing work with configuration Signed-off-by: JeffH-AWS <[email protected]> * Finished - ready for reviews Signed-off-by: JeffH-AWS <[email protected]> * Fixed a link I forgot to change before Signed-off-by: JeffH-AWS <[email protected]> * Changes from first proofread Signed-off-by: JeffH-AWS <[email protected]> * Changed heading Signed-off-by: JeffH-AWS <[email protected]> * Addressed reviewer comments and made some changes Signed-off-by: JeffH-AWS <[email protected]> * Forgot to incorporate one change. Fixed. Signed-off-by: JeffH-AWS <[email protected]> * Final editorial changes Signed-off-by: JeffH-AWS <[email protected]> Signed-off-by: JeffH-AWS <[email protected]> * fix#1584-custom_attr_allowlist (#1636) Signed-off-by: cwillum <[email protected]> Signed-off-by: cwillum <[email protected]> * Update TERMS.md with definition for Setting (#1632) * fix#1631-Terms-setting Signed-off-by: cwillum <[email protected]> * fix#1631-Terms-setting Signed-off-by: cwillum <[email protected]> Signed-off-by: cwillum <[email protected]> * Add disclaimer about remote fs usage and an example of setting env var (#1644) * Add disclaimer about remote fs usage and an example of setting env var Signed-off-by: JeffH-AWS <[email protected]> * Enhanced wording a little bit Signed-off-by: JeffH-AWS <[email protected]> Signed-off-by: JeffH-AWS <[email protected]> * [DOC] New documentation: Self-host maps server (#1625) * Add new page self-host maps server Signed-off-by: vagimeli <[email protected]> * Added new content Signed-off-by: vagimeli <[email protected]> * Copy edit Signed-off-by: vagimeli <[email protected]> * Tech review edits Signed-off-by: vagimeli <[email protected]> * Doc review edits Signed-off-by: vagimeli <[email protected]> * Editorial review changes Signed-off-by: vagimeli <[email protected]> * Final edits Signed-off-by: vagimeli <[email protected]> Signed-off-by: vagimeli <[email protected]> * Add feedback. Signed-off-by: Naarcha-AWS <[email protected]> * Fix links Signed-off-by: Naarcha-AWS <[email protected]> Signed-off-by: Naarcha-AWS <[email protected]> Signed-off-by: JeffH-AWS <[email protected]> Signed-off-by: cwillum <[email protected]> Signed-off-by: vagimeli <[email protected]> Co-authored-by: Nate Bower <[email protected]> Co-authored-by: Jeff Huss <[email protected]> Co-authored-by: Chris Moore <[email protected]> Co-authored-by: Melissa Vagi <[email protected]>
6.6 KiB
layout, title, nav_order
| layout | title | nav_order |
|---|---|---|
| default | Explain | 30 |
Explain
Introduced 1.0 {: .label .label-purple }
Wondering why a specific document ranks higher (or lower) for a query? You can use the explain API for an explanation of how the relevance score (_score) is calculated for every result.
OpenSearch uses a probabilistic ranking framework called Okapi BM25 to calculate relevance scores. Okapi BM25 is based on the original TF/IDF framework used by Apache Lucene.
The explain API is an expensive operation in terms of both resources and time. On production clusters, we recommend using it sparingly for the purpose of troubleshooting. {: .warning }
Example
To see the explain output for all results, set the explain flag to true either in the URL or in the body of the request:
POST opensearch_dashboards_sample_data_ecommerce/_search?explain=true
{
"query": {
"match": {
"customer_first_name": "Mary"
}
}
}
More often, you want the output for a single document. In that case, specify the document ID in the URL:
POST opensearch_dashboards_sample_data_ecommerce/_explain/EVz1Q3sBgg5eWQP6RSte
{
"query": {
"match": {
"customer_first_name": "Mary"
}
}
}
Path and HTTP methods
GET <target>/_explain/<id>
POST <target>/_explain/<id>
URL parameters
You must specify the index and document ID. All other URL parameters are optional.
| Parameter | Type | Description | Required |
|---|---|---|---|
<index> |
String | Name of the index. You can only specify a single index. | Yes |
<_id> |
String | A unique identifier to attach to the document. | Yes |
analyzer |
String | The analyzer to use in the query string. | No |
analyze_wildcard |
Boolean | Specifies whether to analyze wildcard and prefix queries. Default is false. | No |
default_operator |
String | Indicates whether the default operator for a string query should be AND or OR. Default is OR. | No |
df |
String | The default field in case a field prefix is not provided in the query string. | No |
lenient |
Boolean | Specifies whether OpenSearch should ignore format-based query failures (for example, querying a text field for an integer). Default is false. | No |
preference |
String | Specifies a preference of which shard to retrieve results from. Available options are _local, which tells the operation to retrieve results from a locally allocated shard replica, and a custom string value assigned to a specific shard replica. By default, OpenSearch executes the explain operation on random shards. |
No |
q |
String | Query in the Lucene query string syntax. | No |
stored_fields |
Boolean | If true, the operation retrieves document fields stored in the index rather than the document’s _source. Default is false. |
No |
routing |
String | Value used to route the operation to a specific shard. | No |
_source |
String | Whether to include the _source field in the response body. Default is true. |
No |
_source_excludes |
String | A comma-separated list of source fields to exclude in the query response. | No |
_source_includes |
String | A comma-separated list of source fields to include in the query response. | No |
Response
{
"_index" : "kibana_sample_data_ecommerce",
"_id" : "EVz1Q3sBgg5eWQP6RSte",
"matched" : true,
"explanation" : {
"value" : 3.5671005,
"description" : "weight(customer_first_name:mary in 1) [PerFieldSimilarity], result of:",
"details" : [
{
"value" : 3.5671005,
"description" : "score(freq=1.0), computed as boost * idf * tf from:",
"details" : [
{
"value" : 2.2,
"description" : "boost",
"details" : [ ]
},
{
"value" : 3.4100041,
"description" : "idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:",
"details" : [
{
"value" : 154,
"description" : "n, number of documents containing term",
"details" : [ ]
},
{
"value" : 4675,
"description" : "N, total number of documents with field",
"details" : [ ]
}
]
},
{
"value" : 0.47548598,
"description" : "tf, computed as freq / (freq + k1 * (1 - b + b * dl / avgdl)) from:",
"details" : [
{
"value" : 1.0,
"description" : "freq, occurrences of term within document",
"details" : [ ]
},
{
"value" : 1.2,
"description" : "k1, term saturation parameter",
"details" : [ ]
},
{
"value" : 0.75,
"description" : "b, length normalization parameter",
"details" : [ ]
},
{
"value" : 1.0,
"description" : "dl, length of field",
"details" : [ ]
},
{
"value" : 1.1206417,
"description" : "avgdl, average length of field",
"details" : [ ]
}
]
}
]
}
]
}
}
Response body fields
| Field | Description |
|---|---|
matched |
Indicates if the document is a match for the query. |
explanation |
The explanation object has three properties: value, description, and details. The value shows the result of the calculation, the description explains what type of calculation is performed, and the details shows any subcalculations performed. |
Term frequency (tf) |
How many times the term appears in a field for a given document. The more times the term occurs the higher is the relevance score. |
Inverse document frequency (idf) |
How often the term appears within the index (across all the documents). The more often the term appears the lower is the relevance score. |
Field normalization factor (fieldNorm) |
The length of the field. OpenSearch assigns a higher relevance score to a term appearing in a relatively short field. |
The tf, idf, and fieldNorm values are calculated and stored at index time when a document is added or updated. The values might have some (typically small) inaccuracies as it’s based on summing the samples returned from each shard.
Individual queries include other factors for calculating the relevance score, such as term proximity, fuzziness, and so on.