Elasticsearch-mapper-attachments doesn't seems to be showing the actual text after searching instead returning base64 string


(Nitin Sahu) #1
      Steps I followed 
  1. Installed elasticsearch 2.1.1

  2. Installed mapper plugin using the below mentioned command

bin/plugin install elasticsearch/elasticsearch-mapper-attachments/3.1.1

  1. Then I ran the following commands

DELETE /test
PUT /test
PUT /test/person/_mapping
{
"person": {
"properties": {
"file": {
"type": "attachment",
"fields": {
"content": {
"type": "string",
"term_vector":"with_positions_offsets",
"store": true
}
}
}
}
}
}
PUT /test/person/1?refresh=true
{
"file": "IkdvZCBTYXZlIHRoZSBRdWVlbiIgKGFsdGVybmF0aXZlbHkgIkdvZCBTYXZlIHRoZSBLaW5nIg=="
}
GET /test/person/_search
{
"fields": [],
"query": {
"match": {
"file.content": "king queen"
}
},
"highlight": {
"fields": {
"file.content": {
}
}
}
}

And the output which I get is mentioned below

{

"took": 1,
"timed_out": false,
"_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
},
"hits": {
    "total": 1,
    "max_score": 1,
    "hits": [
        {
            "_index": "test",
            "_type": "person",
            "_id": "1",
            "_score": 1,
            "_source": {
                "file": "IkdvZCBTYXZlIHRoZSBRdWVlbiIgKGFsdGVybmF0aXZlbHkgIkdvZCBTYXZlIHRoZSBLaW5nIg=="
            }
        }
    ]
}

}

I was expecting something like this

{
"took": 9,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 0.13561106,
"hits": [
{
"_index": "test",
"_type": "person",
"_id": "1",
"_score": 0.13561106,
"highlight": {
"file.content": [
""God Save the Queen" (alternatively "God Save the King"\n"
]
}
}
]
}
}

I am using Windows 8.1 and Java 1.8.0_25


(system) #2