mkdir pelias
git clone [email protected]:pelias/schema.git
npm install
(if you used homebrew to install elasticsearch it should be /usr/local/Cellar/elasticsearch
)
#!/usr/bin/env ruby | |
require 'json' | |
require 'net/http' | |
require 'nokogiri' | |
json = File.read('citibike_in.geojson') | |
data = JSON.parse(json) | |
out = data |
mkdir pelias
git clone [email protected]:pelias/schema.git
npm install
(if you used homebrew to install elasticsearch it should be /usr/local/Cellar/elasticsearch
)
for shard in $(curl -XGET http://localhost:9200/_cat/shards | grep UNASSIGNED | awk '{print $2}'); do | |
curl -XPOST 'localhost:9200/_cluster/reroute' -d '{ | |
"commands" : [ { | |
"allocate" : { | |
"index" : "pelias", | |
"shard" : $shard, | |
"node" : "pelias-1", | |
"allow_primary" : true | |
} | |
} |
curl -XPUT localhost:9200/_template/marvel_custom -d ' | |
{ | |
"order" : 1, | |
"template" : ".marvel*", | |
"settings" : { | |
"number_of_replicas" : 0 | |
} | |
}' |
http://pelias.stage.mapzen.com/search?input=3107%20Hyde,%20Oakland
These are the actual results from ES for the query -
{ | |
"took":344, | |
"timed_out":false, | |
"_shards":{ | |
"total":40, | |
"successful":40, | |
"failed":0 | |
}, | |
"hits":{ | |
"total":165113284, |
# get the number of distinct category values in the index | |
curl -XGET "http://localhost:9200/pelias/_search?search_type=count" -d' | |
{ | |
"aggs": { | |
"categories": { | |
"cardinality": { | |
"field": "category" | |
} | |
} | |
} |