I am using ES 1.7 and have installed mapper-attachment plugin version 2.7.0.
I am following the steps from the below URL to understand the basic functionality.
http://www.elasticsearch.cn/tutorials/2011/07/18/attachment-type-in-action.html
I am executing the commands in below sequence-
curl -X DELETE "localhost:9200/test"
curl -X PUT "localhost:9200/test/attachment/\_mapping" -d '{
  "attachment" : {
    "properties" : {
      "file" : {
        "type" : "attachment",
        "fields" : {
          "title" : { "store" : "yes" },
          "file" : { "term_vector":"with_positions_offsets", "store":"yes" }
        }
      }
    }
  }
}'
- Indexing the data using below scripts-
 
#!/bin/sh
coded=`cat fn6742.pdf | perl -MMIME::Base64 -ne 'print encode_base64($_)'`
json="{\"file\":\"${coded}\"}"
echo "$json" > json.file
curl -X POST "localhost:9200/test/attachment/" -d @json.file
and doing search using below URL
curl "localhost:9200/_search?pretty=true" -d '{
  "fields" : ["title"],
  "query" : {
    "query_string" : {
      "query" : "amplifier"
    }
  },
  "highlight" : {
    "fields" : {
      "file" : {}
    }
  }
}'
this search query always ended up with '0' hits though the word i am searching for present in my file.