Skip to content

Instantly share code, notes, and snippets.

@carlos22
Forked from jprante/rangequery.sh
Last active September 4, 2015 13:22
Show Gist options
  • Save carlos22/3f8810be6f2cc3f0cd25 to your computer and use it in GitHub Desktop.
Save carlos22/3f8810be6f2cc3f0cd25 to your computer and use it in GitHub Desktop.
Range query example
curl -XDELETE 'localhost:9201/test'
curl -XPUT 'localhost:9201/test/data/1' -d '
{
"valid_start":[11,23,13,16,17,23.6],
"valid_end":[110,230,130,160,170,230.6]
},
'
curl -XPUT 'localhost:9201/test/data/2' -d '
{
"valid_start":[1,2,3,4,5,6,7,8,8.9,9.1,9.4],
"valid_end":[10,20,30,40,50,60,70,80,80.9,90.1,90.4]
}
'
curl -XPUT 'localhost:9201/test/data/3' -d '
{
"valid_start":[101,230,150,200],
"valid_end":[1010,2300,1500,2000]
}
'
curl -XGET 'localhost:9201/test/_refresh'
curl -XGET 'localhost:9201/test/_search?pretty' -d '
{
"query" : {
"bool": {
"must": [
{"range": {
"valid_start": { "lt" : 10 }
}},
{"range": {
"valid_end": { "gt" : 10 }
}}
]
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment