Skip to content

Instantly share code, notes, and snippets.

curl -XPUT localhost:9200/test
curl -XPUT localhost:9200/test/geojson/_mapping -d '
{
"geojson": {
"properties": {
"properties": {
"type": "object",
"dynamic": "true",
"properties": {
"categories": {
curl -XPUT localhost:9200/test
curl -XPUT localhost:9200/test/tweet/_mapping -d '
{
"tweet" : {
"properties" : {
"name" : {
"type" : "string"
},
"comments" : {
"properties" : {
{
"pin" : {
"properties" : {
"location1" : {
"type" : "geo_point"
},
"location2" : {
"type" : "geo_point"
}
}
{
"my_type" : {
"properties" : {
"channel_name" : {
"type" : "multi_field",
"fields" : {
"channel_name" : {"type" : "string"},
"as_is" : {"type" : "string", "index" : "not_analyzed"}
}
}
curl -XPUT localhost:9200/_template/test -d '{
"template" : "test*",
"order" : 0,
"settings" : {
"number_of_shards": 2,
"number_of_replicas": 0
},
"mappings" : {
"test" : {
"properties" : {
curl -X POST "http://localhost:9200/users_test" -d '{
"mappings" : {
"user": {
"dynamic_templates":[{
"long": {
"match_mapping_type":"long",
"match":"*",
"mapping":{
"type":"long",
"include_in_all":false
curl -X POST "http://localhost:9200/users_test" -d '{
"mappings" : {
"user": {
"dynamic_templates":[{
"long": {
"match_mapping_type":"long",
"match":"*",
"mapping":{
"type":"long",
"include_in_all":false
{
"[your_mapping_type_here]" : {
"properties" : {
"location" : {
"properties" : {
"pos" : {"type" : "geo_point"}
}
}
}
}
{
"[your_mapping_type_here]" : {
"properties" : {
"address" : {
"properties" : {
"pos" : {"type" : "geo_point"}
}
}
}
}
curl -XPUT 'http://localhost:9200/twitter/tweet/alksjdf' -d '{
"user" : "kimchy",
"post_date" : "2009-11-15T14:12:12",
"message" : "trying out Elastic Search"
}'