Note that there are some explanatory texts on larger screens.

plurals
  1. POElastic search With MongoDB : Searching PDFs
    primarykey
    data
    text
    <p>I were trying to save my pdf file in Mongo Db's gridFS and then searching in that pdfs using elastic search. I performed following :</p> <p>1) Mongo DB Side:</p> <pre><code>mongod --port 27017 --replSet rs0 --dbpath "D:\Mongo-DB\mongodb-win32-i386-2.0.7\data17" mongod --port 27018 --replSet rs0 --dbpath "D:\Mongo-DB\mongodb-win32-i386-2.0.7\data18" mongod --port 27019 --replSet rs0 --dbpath "D:\Mongo-DB\mongodb-win32-i386-2.0.7\data19" mongo localhost:27017 rs.initiate() rs.add("hostname:27018") rs.add("hostname:27019") mongofiles -hlocalhost:27017 --db testmongo --collection files --type application/pdf put D:\Sherlock-Holmes.pdf </code></pre> <p>2) Elastic Search Side (Installed Plugins : bigdesk/head/mapper-attachments/river-mongodb)</p> <p>-> Using Elastic Search Head given following request from "Any request" tab</p> <pre><code>URL : http://localhost:9200/_river/mongodb/ _meta/PUT { "type": "mongodb", "mongodb": { "db": "testmongo", "collection": "fs.files", "gridfs": true, "contentType": "", "content": "base64 /path/filename | perl -pe 's/\n/\\n/g'" }, "index": { "name": "testmongo", "type": "files", "content_type": "application/pdf" } } </code></pre> <p>Now i am trying to access following URL :</p> <pre><code>http://localhost:9200/testmongo/files/508e82e21e43def09b5e1602?pretty=true </code></pre> <p>I got following response (Which i believe is as expected) :</p> <pre><code>{ "_index" : "testmongo", "_type" : "files", "_id" : "508e82e21e43def09b5e1602", "_version" : 1, "exists" : true, "_source" : {"_id":"508e82e21e43def09b5e1602","filename":"D:\\Sherlock-Holmes.pdf","chunkSize":262144,"uploadDate":"2012-10-29T13:21:38.969Z","md5":"025fa2046f9254d2aecb9e52ae851065","length":98272,"contentType":"application/pdf"} } </code></pre> <p>But when i were trying to search on this pdf using following URL:</p> <pre><code>http://localhost:9200/testmongo/files/_search?q=Albers&amp;pretty=true </code></pre> <p>Its giving me following result :</p> <pre><code>{ "took" : 0, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 0, "max_score" : null, "hits" : [ ] } } </code></pre> <p>Here its showing me no any hit but word "Albers" present in this pdf. Please help. Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload