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 | |
#delete the test type | |
curl -XDELETE localhost:9200/test/test2/ | |
#insert some docs###### | |
curl -XPOST localhost:9200/test/test2/ -d '{ | |
"id": 123, | |
"a": 10, | |
"b": 12, |
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 | |
#delete the test index | |
curl -XDELETE localhost:9200/testing/ | |
echo | |
#put the document | |
curl -XPOST localhost:9200/testing/testing/ -d '{ | |
"document": { | |
"title": "foo", | |
"id": 1, |
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 inserter.py | |
import pyes | |
import sys | |
conn = pyes.ES('127.0.0.1:9200', bulk_size=int(sys.argv[2])) | |
for i in range(int(sys.argv[1])): | |
conn.index({"name":"Joe Tester", "parsedtext":"Joe Testere nice guy", "uuid":"11111", "position":1}, "test-index", "test-type", bulk=True) | |
$ time python inserter.py 1000 1 |
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 | |
#{"ok":true,"acknowledged":true} | |
curl -XPOST localhost:9200/test/test/ -d '{"timestamp": "random_date", "tag":"red", "counter": 3}' | |
#{"ok":true,"_index":"test","_type":"test","_id":"MLv-xERyTFaIdkQeaxoiaw","_version":1} | |
curl -XPOST localhost:9200/test/test/ -d '{"timestamp": "random_date", "tag":"red", "counter": 7}' | |
#{"ok":true,"_index":"test","_type":"test","_id":"JaMQIZpbQaKrgdTOtaEEcg","_version":1} | |
curl -XPOST localhost:9200/test/test/ -d '{"timestamp": "random_date", "tag":"blue", "counter": 5}' |
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" | |
}, |
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
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
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
{ | |
"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 -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" | |
} | |
} |