Created
June 4, 2015 12:42
-
-
Save strukturedkaos/a6151805daabe88b7454 to your computer and use it in GitHub Desktop.
Elasticsearch exploration
This file contains 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
Setup snapshot repo: | |
curl -XPUT 'http://localhost:9200/_snapshot/demo_nyc_accidents' -d '{ | |
"type": "url", | |
"settings": { | |
"url": "http://download.elasticsearch.org/demos/nycopendata/snapshot/" | |
} | |
}' | |
# Monitor recovery: | |
curl -XPOST 'http://localhost:9200/_snapshot/demo_nyc_accidents/demo_nyc_accidents/_restore' | |
CURL -XGET 'http://localhost:9200/nyc_visionzero/_search?search_type=count' -d '{ | |
"aggs" : { | |
"all_boroughs": { | |
"terms": { | |
"field": "borough" | |
} | |
} | |
} | |
}' | pp | |
CURL -XGET 'http://localhost:9200/nyc_visionzero/_search?search_type=count' -d '{ | |
"aggs" : { | |
"months": { | |
"date_histogram": { | |
"field": "@timestamp", | |
"interval": "month" | |
} | |
} | |
} | |
}' | pp | |
response = Product.search query: { match: { title: "Fox Dogs" } }, | |
highlight: { fields: { title: {} } } | |
response.results.first.highlight.title | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment