Files
elasticsearch-js/docs/_examples/explain.asciidoc
Spencer 9e3b71510f [15.x] Update docs to use async/await (#667) (#668)
Backports the following commits to 15.x:
 - Update docs to use async/await  (#667)
2018-05-23 14:32:16 -07:00

29 lines
520 B
Plaintext

.See how a document is scored against a simple query
[source,js]
---------
const response = await client.explain({
// the document to test
index: 'myindex',
type: 'mytype',
id: '1',
// the query to score it against
q: 'field:value'
});
---------
.See how a document is scored against a query written in the Query DSL
[source,js]
---------
const response = await client.explain({
index: 'myindex',
type: 'mytype',
id: '1',
body: {
query: {
match: { title: 'test' }
}
}
});
---------