elasticserach FScrawler intermediate file location? help

I am looking for a method that can intercept the output of FSCrwaler before this gets passed to the elastic engine for indexing.

Just take a case, what I have is a PDF file which I wanted to index plus I also have some attributes/metadata for the same PDF which are stored in the database. I want to index both the content (PDF file content + attributes stored in PostgreSQL) in a single index file so that I can refine my search criteria and get correct results. As far I understand for PDF indexing text needs to be extracted from the file and stored in a text format and then passed to the indexing engine. I am relatively new (an HTDIG veteran -:D ) to the elastic ecosystem so looking for a way to intercept the text extracted from a PDF file so that I can append other text (in this scenario fetched from PostgreSQL) and then pass to the indexing mechanism, a kind of single index file for both the content.

Wondering if anyone has encountered this kind of scenario and can provide some pointers? It will be good to know that where does FSCrawler stores intermediate files created during the indexing process in elastic search? Can we intercept them and add some custom info?

Comments will be much appreciated!

Thanks!

Implementing mapper attachment in elasticsearch

Create a new index
[code lang=”bash”]curl -X PUT "192.168.0.37:9200/test" -d ‘{
"settings" : { "index" : { "number_of_shards" : 1, "number_of_replicas" : 0 }}
}'[/code]

Mapping attachement type
[code lang=”bash”]curl -X PUT "192.168.0.37:9200/test/attachment/_mapping" -d ‘{
"attachment" : {
"properties" : {
"file" : {
"type" : "attachment",
"fields" : {
"title" : { "store" : "yes" },
"file" : { "term_vector":"with_positions_offsets", "store":"yes" }
} } } } }'[/code]

Shell script to convert content to base64 encoding and index
[code lang=”bash”]#!/bin/sh</code>

coded=`cat TestPDF.pdf | perl -MMIME::Base64 -ne ‘print encode_base64($_)’`
json="{\"file\":\"${coded}\"}"
echo "$json" &gt; json.file
curl -X POST "192.168.0.37:9200/test/attachment/" -d @json.file
[/code]
Query  (Search esults will be highlighted)
[code lang=”bash”]curl "192.168.0.37:9200/_search?pretty=true" -d ‘{
"fields" : ["title"],
"query" : {
"query_string" : {
"query" : "Cycling tips"
}
},
"highlight" : {
"fields" : {
"file" : {}
} } }'[/code]

***********************************************************************

If you want to explore more check Full Code on GitHub