Last active
October 31, 2017 07:57
-
-
Save jettro/94a52a618fa3bc12387dcd911503907d to your computer and use it in GitHub Desktop.
Example configs to import the Signal Media News dataset into elasticsearch using logstash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| curl -XGET "http://localhost:9200/signalmedia/_search" -H 'Content-Type: application/json' -d' | |
| { | |
| "query": { | |
| "match": { | |
| "content": "rain" | |
| } | |
| }, | |
| "aggs": { | |
| "my_sampler": { | |
| "sampler": { | |
| "shard_size": 200 | |
| }, | |
| "aggs": { | |
| "keywords": { | |
| "significant_text": { | |
| "field": "content", | |
| "filter_duplicate_text": true | |
| } | |
| } | |
| } | |
| } | |
| }, | |
| "size": 0 | |
| }' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # bin/logstash -f ../configs/signalmedia.conf | |
| input { | |
| file { | |
| path => "/Volumes/Transcend/signalmedia-1m.jsonl" | |
| codec => "json" | |
| start_position => beginning | |
| } | |
| } | |
| filter { | |
| mutate { | |
| copy => {"id" => "[@metadata][id]"} | |
| } | |
| mutate { | |
| remove_field => ["@timestamp", "@version", "host", "message", "path", "id"] | |
| } | |
| } | |
| output { | |
| elasticsearch { | |
| index => "signalmedia" | |
| document_id => "%{[@metadata][id]}" | |
| document_type => "doc" | |
| manage_template => "true" | |
| template => "./signalmedia-template.json" | |
| template_name => "signalmediatemplate" | |
| } | |
| stdout { codec => dots } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "index_patterns": ["signalmedia"], | |
| "settings": { | |
| "number_of_replicas": 0, | |
| "number_of_shards": 3 | |
| }, | |
| "mappings": { | |
| "doc": { | |
| "properties": { | |
| "source": { | |
| "type": "keyword" | |
| }, | |
| "published": { | |
| "type": "date" | |
| }, | |
| "title": { | |
| "type": "text" | |
| }, | |
| "media-type": { | |
| "type": "keyword" | |
| }, | |
| "content": { | |
| "type": "text" | |
| } | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment