Hi  David,

this is what I did to get text of the attachment:

curl -X DELETE "localhost:9200/test"


curl -X PUT "localhost:9200/test" -d '{

   "settings" : {

    "index": {

       "analysis" :{

        "analyzer": {

           "default": {

             "type" : "custom",

             "tokenizer" : "uax_url_email",

             "filter" : ["standard", "lowercase", "stop"]

           }

         }

       }

     }

   }

 }'


curl -X PUT "localhost:9200/test/attachment/_mapping" -d '{

  "attachment" : {

    "properties" : {

      "file" : {

        "type" : "attachment",

        "index":"yes",

        "path":"full",

        "fields" : {

          "title" : { "store" : "yes" },

          "file" : { "term_vector":"with_positions_offsets", "type": 
"string", "store":"yes" }

        }

      }

    }

  }

}'

#!/bin/sh


coded=`cat tonfichier.pdf | perl -MMIME::Base64 -ne 'print 
encode_base64($_)'`

json="{\"file\":\"${coded}\"}"

echo "$json" > json.file

url -X POST "localhost:9200/test/attachment/" -d @json.file


To get the readable text i execute :


curl -XGET 'http://localhost:9200/test/attachment/_search?pretty' -d '

    {

   "fields": [

      "file"

   ]

}


Now, I need to extract the text in another file (.txt for exemple or cvs). 
I can't do it.


I am trying another query now, nothing works:


curl -XGET 'http://localhost:9200/test/attachment/_search?pretty' -d '

    {

   "fields": [

      "file"

   ]

}

'| jq '.[] | .fields.file | @csv'

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  
Current

                                 Dload  Upload   Total   Spent    Left  
Speed

100  155k  100  155k  100    42  8945k   2423 --:--:-- --:--:-- --:--:-- 
9118k

jq: error: Cannot index number with string

jq: error: Cannot index boolean with string

jq: error: null cannot be csv-formatted, only array

jq: error: null cannot be csv-formatted, only array

my jq syntax is wrong I think. 

Thank you for helping me every time :)

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/d9379e19-9922-48d6-9f2a-eea291924f0b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to