Skip to content

Instantly share code, notes, and snippets.

@hxuanji
Last active February 9, 2017 02:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hxuanji/35b982b86b3601cb5571 to your computer and use it in GitHub Desktop.
Save hxuanji/35b982b86b3601cb5571 to your computer and use it in GitHub Desktop.
empty string finding test
echo -e "delete index..."
curl -XDELETE "http://localhost:5028/test"
echo -e "\ncreate index..."
curl -XPUT "http://localhost:5028/test" -d '
{
"settings": {
"index": {
"number_of_shards": 5,
"number_of_replicas": 0,
"analysis": {
"analyzer": {
},
"filter": {
}
}
}
},
"mappings": {
"main": {
"properties": {
"name": { "type": "string", "index": "analyzed", "analyzer": "standard", "include_in_all": true}
}
}
}
}
'
echo -e "\npush doc..."
curl -XPOST "http://localhost:5028/test/main" -d '{"name": ""}'
curl -XPOST "http://localhost:5028/test/main" -d '{"name": "22"}'
echo -e "\nsearch..."
sleep 2
#curl -XPOST "http://localhost:5028/test/main/_search" -d '{"from": 0, "size": 100, "query":{"term": {"name":""}}}' # for not_analyze field
curl -XPOST "http://localhost:5028/test/main/_search" -d '{"filter": {"missing": {"existence": true, "field": "name", "null_value": true}}, "query": {"match_all": {}}}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment