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
curl -XDELETE localhost:9200/test | |
curl -XPUT localhost:9200/test | |
curl -XPUT localhost:9200/test/p/_mapping -d '{ | |
"p" :{ | |
"_ttl" : { "enabled" : true, "default": "10s" } | |
} | |
}' | |
curl -XPUT localhost:9200/test/c/_mapping -d '{ | |
"c" :{ | |
"_ttl" : { "enabled" : true, "default": "20s" } |
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
curl -XDELETE localhost:9200/test | |
curl -XPUT localhost:9200/test | |
curl -XPUT localhost:9200/test/parent/1 -d '{"foo": "p_foo1"}' | |
curl -XPUT localhost:9200/test/parent/2 -d '{"foo": "p_foo1"}' | |
curl -XPUT localhost:9200/test/child/_mapping -d '{ | |
"child": { | |
"_parent": { | |
"type": "parent" | |
} | |
} |
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
{ | |
"template_1" : { | |
"template" : "*", | |
"access-log" : { | |
"properties" : { | |
"@fields": { | |
"dynamic": "true", | |
"properties": { | |
"accessdate" : { | |
"index" : "not_analyzed", |
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
curl -XPUT localhost:9200/testindex/testtype/_mapping -d '{ | |
"testtype": { | |
"properties":{ | |
"Address": { | |
"dynamic": true, | |
"properties": { | |
"City": {"type": "string", "index": "not_analyzed"} | |
} | |
} | |
} |
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
curl -XDELETE localhost:9200/test | |
curl -XPUT localhost:9200/test -d '{ | |
"index.mapper.dynamic": false | |
}' | |
#{"ok":true,"acknowledged":true} | |
curl -XPUT localhost:9200/test/test/1 -d '{"foo":"bar"}' | |
#{"error":"TypeMissingException[[test] type[test] missing: trying to auto create mapping, but dynamic mapping is disabled]","status":404} |
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
$ cat a.php | |
<?php | |
$cmd = "curl -XPUT http://localhost:9200/_bulk --data-binary @bulkIndex.data"; | |
exec($cmd); | |
?> | |
$ cat bulkIndex.data | |
{"index" : {"_index":"test","_type":"mo","_id":"1"} } | |
{"CDR_ID":"4894","MSISDN":"14169988312","SHORT_CODE":"44446","APP_ID":"1158","OPERATOR_ID":"0","SHORT_MESSAGE":"Test1","SMS_ID":"19f1eb3d1b5579781ba1c051d8d6739e","DATE_TIMESTAMP":"20120727131710","INSERT_TIMESTAMP":"20121129212256"} | |
{ "index" : {"_index":"test","_type":"mo","_id":"2"} } | |
{"CDR_ID":"4895","MSISDN":"17059380753","SHORT_CODE":"41128","APP_ID":"1038","OPERATOR_ID":"0","SHORT_MESSAGE":"Test2","SMS_ID":"d8d849f760623f1720ef08634b3867b4","DATE_TIMESTAMP":"20120727131804","INSERT_TIMESTAMP":"20121129212256"} |
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
#cleanup first | |
curl -XDELETE localhost:9200/test/ | |
echo | |
#create index | |
curl -XPUT localhost:9200/test | |
echo | |
#create parent type | |
curl -XPUT localhost:9200/test/test_parent |
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 | |
#shows traffic on the specified device | |
function human_readable { | |
VALUE=$1 | |
BIGGIFIERS=( B K M G ) | |
CURRENT_BIGGIFIER=0 | |
while [ $VALUE -gt 10000 ] ;do | |
VALUE=$(($VALUE/1000)) |
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
$ cat req | |
{ "index" : { "_type" : "type1", "_id" : "1" } } | |
{ "field1" : "value1" } | |
{ "index" : { "_type" : "type1", "_id" : "2" } } | |
{ "field1" : "value2" } | |
$ curl -XPOST localhost:9200/testing/_bulk?pretty=true --data-binary @req | |
{ | |
"took" : 5, | |
"items" : [ { | |
"index" : { |
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
$ curl -XPOST localhost:9200/test/test/ -d '{"timestamp": "random_date", "tag":"blue", "counter": "5"}' | |
{"ok":true,"_index":"test","_type":"test","_id":"qVmyc9otSqWqUOKWoteM5Q","_version":1} | |
$ curl -XGET localhost:9200/test/test/_mapping?pretty=true | |
{ | |
"test" : { | |
"properties" : { | |
"counter" : { | |
"type" : "string" | |
}, |