Skip to content

Instantly share code, notes, and snippets.

@hscells
Last active August 10, 2017 23:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hscells/4d52456b000220fd2fcf2b480c125052 to your computer and use it in GitHub Desktop.
Save hscells/4d52456b000220fd2fcf2b480c125052 to your computer and use it in GitHub Desktop.
Elasticsearch - Accessing a Term Vector
# Previous example
# https://gist.github.com/hscells/774e112d14e3f249e8960d7147d61353
# Access the term vector for the `body` field
# https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html
curl -X GET "localhost:9200/example/doc/AV3OdFAZ7fqYee2bfgSQ/_termvectors?term_statistics&fields=body"
# =>
# {
# "_index" : "example",
# "_type" : "doc",
# "_id" : "AV3OdFAZ7fqYee2bfgSQ",
# "_version" : 1,
# "found" : true,
# "took" : 0,
# "term_vectors" : {
# "body" : {
# "field_statistics" : {
# "sum_doc_freq" : 4,
# "doc_count" : 1,
# "sum_ttf" : 4
# },
# "terms" : {
# "the" : {
# "doc_freq" : 1,
# "ttf" : 1,
# "term_freq" : 1,
# "tokens" : [
# {
# "position" : 2,
# "start_offset" : 11,
# "end_offset" : 14
# }
# ]
# },
# "to" : {
# "doc_freq" : 1,
# "ttf" : 1,
# "term_freq" : 1,
# "tokens" : [
# {
# "position" : 1,
# "start_offset" : 8,
# "end_offset" : 10
# }
# ]
# },
# "welcome" : {
# "doc_freq" : 1,
# "ttf" : 1,
# "term_freq" : 1,
# "tokens" : [
# {
# "position" : 0,
# "start_offset" : 0,
# "end_offset" : 7
# }
# ]
# },
# "workshop" : {
# "doc_freq" : 1,
# "ttf" : 1,
# "term_freq" : 1,
# "tokens" : [
# {
# "position" : 3,
# "start_offset" : 15,
# "end_offset" : 23
# }
# ]
# }
# }
# }
# }
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment