Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
return term vectors and some statistics for a document #3114
This feature seems to be useful as can be seen by typing "term vectors elasticsearch" in google.
Here is how it should work:
Returns information and statistics on terms in the fields of a particular document as stored in the index.
Tree types of values can be requested: term information, term statistics and field statistics.
Optionally, you can specify the fields for which the information is retrieved either with a parameter in the url
or adding by adding the requested fields in the request body (see example below).
YOU MUST ENABLE TERM VECTOR STORING FOR USING THE API
See mapping doc and the example below on how to do that.
If the requested information wasn't stored in the index, it will be omitted without further warning.
Setting "term_statistics" to "true" (default is "false") will return
By default these values are not returned since term statistics can have a serious performance impact.
Setting "field_statistics" to "false" (default is "true") will omit
The term and field statistics are not accurate. Deleted documents are not taken into account. The information is only retrieved for the shard the requested document resides in. The term and field statistics are therefore only useful as relative measures whereas the absolute numbers have no meaning in this context.
First, we create an index that stores term vectors, payloads etc. :
Second, we add some documents:
The following request returns all information and statistics for field "text" in document "1" (John Doe):
Equivalently, all parameters can be passed as URI parameters:
This is similar to Issue #2691