Skip to content

Instantly share code, notes, and snippets.

@coolacid
Last active December 11, 2015 18:43
Show Gist options
  • Save coolacid/14570b3ce673dcf3f428 to your computer and use it in GitHub Desktop.
Save coolacid/14570b3ce673dcf3f428 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Tested against 2.1.0 and 1.7.3
# Create the first document - note, string is a quoted
curl -XPUT 'http://localhost:9200/testindex/test/1' -d '{
"data": "test",
"number" : 1,
"string" : "0"
}'
# Create the second document - note, string is NOT quoted
curl -XPUT 'http://localhost:9200/testindex/test/2' -d '{
"data": "test",
"number" : 1,
"string" : 0
}'
sleep 5 #Wait for index to happen
# Mapping shows string to be mapped to a string
curl -XGET 'http://localhost:9200/testindex/_mapping?pretty'
# However, elasticsearch returns a number for 2
curl -XGET 'http://localhost:9200/testindex/test/1'
curl -XGET 'http://localhost:9200/testindex/test/2'
curl -XDELETE 'http://localhost:9200/testindex'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment