mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-23 13:26:02 +00:00
parent
a8b376670c
commit
88c5627a1b
@ -98,7 +98,6 @@ buildRestTests.expectedUnconvertedCandidates = [
|
||||
'reference/docs/delete.asciidoc',
|
||||
'reference/docs/index_.asciidoc',
|
||||
'reference/docs/multi-get.asciidoc',
|
||||
'reference/docs/multi-termvectors.asciidoc',
|
||||
'reference/docs/reindex.asciidoc',
|
||||
'reference/docs/termvectors.asciidoc',
|
||||
'reference/docs/update-by-query.asciidoc',
|
||||
|
@ -12,25 +12,28 @@ API. Here is an example:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
curl 'localhost:9200/_mtermvectors' -d '{
|
||||
POST /_mtermvectors
|
||||
{
|
||||
"docs": [
|
||||
{
|
||||
"_index": "testidx",
|
||||
"_type": "test",
|
||||
"_index": "twitter",
|
||||
"_type": "tweet",
|
||||
"_id": "2",
|
||||
"term_statistics": true
|
||||
},
|
||||
{
|
||||
"_index": "testidx",
|
||||
"_type": "test",
|
||||
"_index": "twitter",
|
||||
"_type": "tweet",
|
||||
"_id": "1",
|
||||
"fields": [
|
||||
"text"
|
||||
"message"
|
||||
]
|
||||
}
|
||||
]
|
||||
}'
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[setup:twitter]
|
||||
|
||||
See the <<docs-termvectors,termvectors>> API for a description of possible parameters.
|
||||
|
||||
@ -39,34 +42,38 @@ is not required in the body):
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
curl 'localhost:9200/testidx/_mtermvectors' -d '{
|
||||
POST /twitter/_mtermvectors
|
||||
{
|
||||
"docs": [
|
||||
{
|
||||
"_type": "test",
|
||||
"_type": "tweet",
|
||||
"_id": "2",
|
||||
"fields": [
|
||||
"text"
|
||||
"message"
|
||||
],
|
||||
"term_statistics": true
|
||||
},
|
||||
{
|
||||
"_type": "test",
|
||||
"_type": "tweet",
|
||||
"_id": "1"
|
||||
}
|
||||
]
|
||||
}'
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[setup:twitter]
|
||||
|
||||
And type:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
curl 'localhost:9200/testidx/test/_mtermvectors' -d '{
|
||||
POST /twitter/tweet/_mtermvectors
|
||||
{
|
||||
"docs": [
|
||||
{
|
||||
"_id": "2",
|
||||
"fields": [
|
||||
"text"
|
||||
"message"
|
||||
],
|
||||
"term_statistics": true
|
||||
},
|
||||
@ -74,24 +81,28 @@ curl 'localhost:9200/testidx/test/_mtermvectors' -d '{
|
||||
"_id": "1"
|
||||
}
|
||||
]
|
||||
}'
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[setup:twitter]
|
||||
|
||||
If all requested documents are on same index and have same type and also the parameters are the same, the request can be simplified:
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
curl 'localhost:9200/testidx/test/_mtermvectors' -d '{
|
||||
POST /twitter/tweet/_mtermvectors
|
||||
{
|
||||
"ids" : ["1", "2"],
|
||||
"parameters": {
|
||||
"fields": [
|
||||
"text"
|
||||
"message"
|
||||
],
|
||||
"term_statistics": true,
|
||||
…
|
||||
"term_statistics": true
|
||||
}
|
||||
}'
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[setup:twitter]
|
||||
|
||||
Additionally, just like for the <<docs-termvectors,termvectors>>
|
||||
API, term vectors could be generated for user provided documents. The mapping used is
|
||||
@ -99,24 +110,27 @@ determined by `_index` and `_type`.
|
||||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
curl 'localhost:9200/_mtermvectors' -d '{
|
||||
POST /_mtermvectors
|
||||
{
|
||||
"docs": [
|
||||
{
|
||||
"_index": "testidx",
|
||||
"_type": "test",
|
||||
"_index": "twitter",
|
||||
"_type": "tweet",
|
||||
"doc" : {
|
||||
"fullname" : "John Doe",
|
||||
"text" : "twitter test test test"
|
||||
"user" : "John Doe",
|
||||
"message" : "twitter test test test"
|
||||
}
|
||||
},
|
||||
{
|
||||
"_index": "testidx",
|
||||
"_index": "twitter",
|
||||
"_type": "test",
|
||||
"doc" : {
|
||||
"fullname" : "Jane Doe",
|
||||
"text" : "Another twitter test ..."
|
||||
"user" : "Jane Doe",
|
||||
"message" : "Another twitter test ..."
|
||||
}
|
||||
}
|
||||
]
|
||||
}'
|
||||
}
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[setup:twitter]
|
||||
|
Loading…
x
Reference in New Issue
Block a user