Skip to content

Instantly share code, notes, and snippets.

@dadoonet
Created April 4, 2013 12:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dadoonet/5310075 to your computer and use it in GitHub Desktop.
Save dadoonet/5310075 to your computer and use it in GitHub Desktop.
Testing FSRiver with Mapper attachment and check metadata extracted
####### PREPARE TEST PLATFORM
### First install elasticsearch 0.20.6
# curl https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.6.zip -o elasticsearch-0.20.6.zip
# unzip elasticsearch-0.20.6.zip
# cd elasticsearch-0.20.6
### Install mapper attachment plugin
# bin/plugin -install elasticsearch/elasticsearch-mapper-attachments/1.6.0
### Install FSRiver plugin
# bin/plugin -install fr.pilato.elasticsearch.river/fsriver/0.0.3
### Start Elasticsearch
# bin/elasticsearch -f
####### START TESTS
### Delete index
curl -XDELETE 'localhost:9200/mydocs'
### Delete river
curl -XDELETE 'localhost:9200/_river/mydocs'
### Create mapping
curl -XPUT 'localhost:9200/mydocs' -d '
{
"doc": {
"properties": {
"file": {
"type": "attachment",
"path": "full",
"fields": {
"file": {
"type": "string",
"store": "yes",
"term_vector": "with_positions_offsets"
},
"author": {
"type": "string",
"store": "yes"
},
"title": {
"type": "string",
"store": "yes"
},
"date": {
"type": "date",
"format": "dateOptionalTime",
"store": "yes"
},
"keywords": {
"type": "string",
"store": "yes"
},
"content_type": {
"type": "string",
"store": "yes"
}
}
}
}
}
}
'
### Create river
curl -XPUT 'localhost:9200/_river/mydocs/_meta' -d '{
"type": "fs",
"fs": {
"name": "My tmp dir",
"url": "/tmp/es",
"update_rate": 10000,
"includes": "*.odt,*.pdf",
"excludes": "*.sh"
}
}'
### Wait for 2 seconds
sleep 2
### Search
curl 'http://localhost:9200/mydocs/doc/_search?pretty' -d '
{
"fields" : ["*"],
"query":{
"match_all" : {}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment