Skip to content

Instantly share code, notes, and snippets.

@jasongilman
Created December 23, 2011 19:24
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 jasongilman/1515140 to your computer and use it in GitHub Desktop.
Save jasongilman/1515140 to your computer and use it in GitHub Desktop.
Reproducing elasticsearch upgrade problem
#!/bin/sh
# Run this on an empty elastic search of 0.17.6
# After running it shutdown elastic and start 0.18.6.
# Then execute this query
# curl -XPOST "http://localhost:9200/echo/dataset/_search" -d '{"query":{"filtered":{"query":{"match_all":{}},"filter":{"and":[{"and":[{"nested":{"path":"minimum_bounding_rectangles","query":{"constant_score":{"filter":{"and":[{"and":[{"range":{"north":{"from":-7.711,"to":90.0}}},{"range":{"south":{"from":-90.0,"to":38.273}}}]},{"or":[{"and":[{"or":[{"range":{"west":{"from":-180.0,"to":-3.164}}},{"range":{"east":{"from":-60.117,"to":180.0}}}]},{"term":{"antimeridian":true}}]},{"and":[{"range":{"west":{"from":-180.0,"to":-3.164}}},{"range":{"east":{"from":-60.117,"to":180.0}}}]}]}]}}}}}]},{"term":{"permitted_group_ids":"guest"}}]}}},"fields":["echo_collection_id"],"sort":["echo_collection_id"],"from":0,"size":2100}'
# Create echo index
curl -XPUT "http://localhost:9200/echo/" -d '
{ "settings" : { "index" : { "number_of_shards" : 3 } } }
'
# Set dataset mapping
curl -XPUT "http://localhost:9200/echo/dataset/_mapping" -d '
{"dataset": {
"dynamic" : "strict",
"_all" : {"enabled" : false},
"_source" : {"compress" : true},
"properties":
{
"permitted_group_ids":{"type":"string","index":"not_analyzed"},
"echo_collection_id":{"type":"string","index":"not_analyzed"},
"minimum_bounding_rectangles": {
"type" : "nested",
"dynamic" : "strict",
"properties": {
"west":{"type":"double"},
"north":{"type":"double"},
"east":{"type":"double"},
"south":{"type":"double"},
"antimeridian":{"type":"boolean"}
}
}
}
}
}
'
# Set granule mapping
curl -XPUT "http://localhost:9200/echo/granule/_mapping" -d '
{"granule":
{
"dynamic" : "strict",
"_all" : {"enabled" : false},
"_source" : {"compress" : true},
"properties":
{
"echo_granule_id":{"type":"string","index":"not_analyzed"},
"minimum_bounding_rectangles": {
"type" : "nested",
"dynamic" : "strict",
"properties": {
"west":{"type":"double"},
"north":{"type":"double"},
"east":{"type":"double"},
"south":{"type":"double"},
"antimeridian":{"type":"boolean"}
}
}
}
}
}
'
curl -XPOST "http://localhost:9200/_bulk" -d '
{"index":{"_index":"echo","_type":"dataset","_id":"C2902-FIX_PROV1"}}
{"permitted_group_ids":["guest","registered"],"echo_collection_id":"C2902-FIX_PROV1"}
{"index":{"_index":"echo","_type":"granule","_id":"G3104-FIX_PROV1"}}
{"minimum_bounding_rectangles":[{"west":-10.0,"north":30.8674777906744,"east":20.0,"south":-40.9808417691338,"antimeridian":false}],"echo_granule_id":"G3104-FIX_PROV1"}
'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment