Skip to content

Instantly share code, notes, and snippets.

View imotov's full-sized avatar

Igor Motov imotov

View GitHub Profile
curl -XDELETE localhost:9200/users
curl -XPUT localhost:9200/users -d '{
"settings": {
"index.number_of_shards": 1,
"index.number_of_replicas": 0
},
"mappings": {
"user": {
"properties": {
"affiliate_program_id": {
{
"enron" : {
"email" : {
"properties" : {
"Attendees" : {
"type" : "string"
},
"Bcc" : {
"type" : "string",
"index" : "not_analyzed",
{
"wikipedia" : {
"article" : {
"properties" : {
"category" : {
"type" : "string"
},
"disambiguation" : {
"type" : "boolean"
},
curl -XDELETE localhost:9200/test
curl -XPUT localhost:9200/test -d '{
"settings": {
"index.number_of_shards": 1,
"index.number_of_replicas": 0
},
"mappings": {
"doc": {
"_timestamp" : {"enabled" : true, "index" : "analyzed", "store" : "yes"}
}
curl -XDELETE localhost:9200/test
curl -XPUT localhost:9200/test -d '{
"settings": {
"index.number_of_shards": 1,
"index.number_of_replicas": 0
}
}'
echo
for i in {1..10}; do curl -XPUT localhost:9200/test/doc/$i -d "{\"foo\":\"bar\", \"doc\":\"$i\"}"; done
echo
curl -XDELETE localhost:9200/test-idx
curl -XPUT localhost:9200/test-idx -d '{
"settings": {
"index.number_of_shards": 1,
"index.number_of_replicas": 0
},
"mappings": {
"doc": {
"properties": {
"name": {"type": "string"}
curl -XDELETE localhost:9200/test-idx
curl -XPUT localhost:9200/test-idx -d '{
"settings": {
"index.number_of_shards": 1,
"index.number_of_replicas": 0
},
"mappings": {
"doc": {
"properties": {
"foo": {"type": "string", "index": "not_analyzed"},
curl -XDELETE localhost:9200/test
curl -XPUT localhost:9200/test -d '{
"settings": {
"index.number_of_shards": 1,
"index.number_of_replicas": 0
},
"mappings": {
"doc": {
"_timestamp" : { "enabled" : true }
}
curl -XDELETE localhost:9200/date-test
echo
curl -XPUT localhost:9200/date-test -d '{
"settings": {
"index.number_of_shards": 1,
"index.number_of_replicas": 0
},
"mappings": {
"doc": {
"properties": {
curl -XPOST http://localhost:9200/test/thing/1 -d '{
"something": "/hello/world"
}'