Created
January 13, 2016 09:51
-
-
Save tstibbs/92de2206531ca37e0764 to your computer and use it in GitHub Desktop.
Named query causes null pointer
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
#!/bin/bash | |
curl -XPUT 'http://localhost:9200/myindex/' -d ' | |
{ | |
"settings": { | |
"index": { | |
"number_of_shards": 1, | |
"number_of_replicas": 0 | |
} | |
}, | |
"mappings": { | |
"doc": { | |
"properties": { | |
"datefield": { | |
"type": "date" | |
}, | |
"children": { | |
"type": "nested" | |
} | |
} | |
} | |
} | |
} | |
' | |
echo | |
curl -XPUT 'http://localhost:9200/myindex/doc/1' -d ' | |
{ | |
"datefield": "2015-04-26", | |
"children": [ | |
{ | |
"thing": "1stuff1" | |
}, | |
{ | |
"thing": "1stuff2" | |
}, | |
{ | |
"thing": "1stuff3" | |
}, | |
{ | |
"thing": "1stuff4" | |
} | |
] | |
} | |
' | |
echo | |
curl -XPUT 'http://localhost:9200/myindex/doc/2' -d ' | |
{ | |
"datefield": "2015-04-27", | |
"children": [ | |
{ | |
"thing": "2stuff1" | |
}, | |
{ | |
"thing": "2stuff2" | |
}, | |
{ | |
"thing": "2stuff3" | |
}, | |
{ | |
"thing": "2stuff4" | |
}, | |
{ | |
"thing": "2stuff5" | |
} | |
] | |
} | |
' | |
echo | |
curl -XPUT 'http://localhost:9200/myindex/doc/3' -d ' | |
{ | |
"datefield": "2015-04-28", | |
"children": [ | |
{ | |
"thing": "3stuff1" | |
}, | |
{ | |
"thing": "3stuff2" | |
}, | |
{ | |
"thing": "3stuff3" | |
}, | |
{ | |
"thing": "3stuff4" | |
}, | |
{ | |
"thing": "3stuff5" | |
}, | |
{ | |
"thing": "3stuff6" | |
} | |
] | |
} | |
' | |
echo | |
# index a bunch more documents | |
for id in `seq 7 4000`; | |
do | |
curl -XPUT "http://localhost:9200/myindex/doc/$id" -d '{}' > /dev/null 2>&1 | |
done | |
# give it a chance to refresh the readers etc | |
read -n1 -r -p "Press any key to perform search..." key | |
### this should return a failure due to a null pointer. | |
curl -XGET 'http://localhost:9200/myindex/doc/_search' -d ' | |
{ | |
"query": { | |
"range": { | |
"datefield": { | |
"gte": "2015-04-27", | |
"_name": "date1", | |
"lte": "2015-04-28" | |
} | |
} | |
} | |
} | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment