-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DOCS] Add examples and descriptions for explain, termvector, search …
…APIs (#3614)
- Loading branch information
Showing
28 changed files
with
840 additions
and
228 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
specification/_global/explain/examples/request/ExplainRequestExample1.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# summary: | ||
# method_request: GET /my-index-000001/_explain/0 | ||
description: > | ||
Run `GET /my-index-000001/_explain/0` with the request body. | ||
Alternatively, run `GET /my-index-000001/_explain/0?q=message:elasticsearch` | ||
# type: request | ||
value: |- | ||
{ | ||
"query" : { | ||
"match" : { "message" : "elasticsearch" } | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
specification/_global/explain/examples/response/ExplainResponseExample1.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# summary: | ||
description: A successful response from `GET /my-index-000001/_explain/0`. | ||
# type: response | ||
# response_code: 200 | ||
value: |- | ||
{ | ||
"_index":"my-index-000001", | ||
"_id":"0", | ||
"matched":true, | ||
"explanation":{ | ||
"value":1.6943598, | ||
"description":"weight(message:elasticsearch in 0) [PerFieldSimilarity], result of:", | ||
"details":[ | ||
{ | ||
"value":1.6943598, | ||
"description":"score(freq=1.0), computed as boost * idf * tf from:", | ||
"details":[ | ||
{ | ||
"value":2.2, | ||
"description":"boost", | ||
"details":[] | ||
}, | ||
{ | ||
"value":1.3862944, | ||
"description":"idf, computed as log(1 + (N - n + 0.5) / (n + 0.5)) from:", | ||
"details":[ | ||
{ | ||
"value":1, | ||
"description":"n, number of documents containing term", | ||
"details":[] | ||
}, | ||
{ | ||
"value":5, | ||
"description":"N, total number of documents with field", | ||
"details":[] | ||
} | ||
] | ||
}, | ||
{ | ||
"value":0.5555556, | ||
"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":3.0, | ||
"description":"dl, length of field", | ||
"details":[] | ||
}, | ||
{ | ||
"value":5.4, | ||
"description":"avgdl, average length of field", | ||
"details":[] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample1.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
summary: Get multi term vectors | ||
# method_request: POST /my-index-000001/_mtermvectors | ||
description: > | ||
Run `POST /my-index-000001/_mtermvectors`. | ||
If you specify an index in the request URI, the index does not need to be specified for each documents in the request body. | ||
# type: request | ||
value: |- | ||
{ | ||
"docs": [ | ||
{ | ||
"_id": "2", | ||
"fields": [ | ||
"message" | ||
], | ||
"term_statistics": true | ||
}, | ||
{ | ||
"_id": "1" | ||
} | ||
] | ||
} |
16 changes: 16 additions & 0 deletions
16
specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample2.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
summary: Simplified syntax | ||
# method_request: POST /my-index-000001/_mtermvectors | ||
description: > | ||
Run `POST /my-index-000001/_mtermvectors`. | ||
If all requested documents are in same index and the parameters are the same, you can use a simplified syntax. | ||
# type: request | ||
value: |- | ||
{ | ||
"ids": [ "1", "2" ], | ||
"parameters": { | ||
"fields": [ | ||
"message" | ||
], | ||
"term_statistics": true | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
specification/_global/mtermvectors/examples/request/MultiTermVectorsRequestExample3.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
summary: Artificial documents | ||
# method_request: POST /_mtermvectors | ||
description: > | ||
Run `POST /_mtermvectors` to generate term vectors for artificial documents provided in the body of the request. | ||
The mapping used is determined by the specified `_index`. | ||
# type: request | ||
value: |- | ||
{ | ||
"docs": [ | ||
{ | ||
"_index": "my-index-000001", | ||
"doc" : { | ||
"message" : "test test test" | ||
} | ||
}, | ||
{ | ||
"_index": "my-index-000001", | ||
"doc" : { | ||
"message" : "Another test ..." | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.