Skip to content

Instantly share code, notes, and snippets.

@michiel
Forked from karmi/test.doc
Created July 4, 2014 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michiel/9779a4ead8dbb0549570 to your computer and use it in GitHub Desktop.
Save michiel/9779a4ead8dbb0549570 to your computer and use it in GitHub Desktop.
{\rtf1\ansi\ansicpg1250\cocoartf1038\cocoasubrtf350
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
{\info
{\title Test RTF document}
{\author John Smith}
{\*\company My Organization}}\paperw11900\paperh16840\margl1440\margr1440\vieww9000\viewh8400\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural
\f0\fs24 \cf0 Test RTF document.\
\
Lorem ipsum dolor.}
# Example of handling attachments in Elasticsearch
# ================================================
#
# 1. Install the plugin: $ plugin -install elasticsearch/elasticsearch-mapper-attachments/1.7.0
# 2. Run the script: $ bash test_attachments.sh
#
# More info: <http://www.elasticsearch.org/guide/reference/mapping/attachment-type/>
curl -X DELETE http://localhost:9200/test_attachments
echo;
curl -X POST http://localhost:9200/test_attachments -d '{
"mappings" : {
"document" : {
"properties" : {
"content" : {
"type" : "attachment",
"fields" : {
"content" : { "store" : "yes" },
"author" : { "store" : "yes" },
"title" : { "store" : "yes", "analyzer" : "english"},
"date" : { "store" : "yes" },
"keywords" : { "store" : "yes", "analyzer" : "keyword" },
"_name" : { "store" : "yes" },
"_content_type" : { "store" : "yes" }
}
}
}
}
}
}'
echo;
echo '>>> Index the document'
curl -i -X PUT http://localhost:9200/test_attachments/document/1 -d "{
\"_name\" : \"test.doc\",
\"content\" : \"$(openssl base64 -in test.doc)\"
}"
echo;
curl -X POST http://localhost:9200/test_attachments/_refresh
echo; echo ">>> Search for author 'John'"
curl "http://localhost:9200/test_attachments/_search?pretty=true&q=content.author:john&fields=content.title,content.author"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment