0

The elasticsearch (1.7) index I am dealing with has a property "title" which has many custom field mappings each having an analyser. How to fetch the data stored in these individual fields?

 title.std
 title.stp 

Here's the mappings data.

 "mappings": {
  "myindex": {
    "_all": {
      "enabled": false
    },
    "properties": {
      "title": {
        "type": "string",
        "analyzer": "standard",
        "fields": {
          "std": {
            "type": "string",
            "analyzer": "standard"
          },
          "stp": {
            "type": "string",
            "analyzer": "stop"
          }
        }
     }
  }
2
  • 1
    You can give the term vectors API a try. Commented May 16, 2017 at 8:08
  • Awesome! You should provide it as an answer so I can upvote. Commented May 16, 2017 at 8:27

1 Answer 1

1

You can use the term vectors API in order to return information and statistics on terms in the fields of a particular document.

You'd invoke the endpoint like this:

curl -XGET 'http://localhost:9200/myindex/mytype/1/_termvector?pretty=true' -d '{
  "fields" : ["title.std", "title.stp"],
  "offsets" : true,
  "payloads" : true,
  "positions" : true,
  "term_statistics" : true,
  "field_statistics" : true
}'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.