Skip to content

Instantly share code, notes, and snippets.

@qvin
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qvin/9911e904c1d127c28dc7 to your computer and use it in GitHub Desktop.
Save qvin/9911e904c1d127c28dc7 to your computer and use it in GitHub Desktop.
Test Data for Elasticsearch
$ curl -XPUT 'http://localhost:9200/testdb/'
$ curl -XPUT 'http://localhost:9200/testdb/testtable/_mapping' -d '{
"testdb" : {
"mappings" : {
"testtable" : {
"properties" : {
"id" : {
"type" : "string"
},
"parentid" : {
"type" : "long"
},
"prop1" : {
"type" : "long"
},
"prop2" : {
"type" : "long"
},
"checkflag" : {
"type" : "boolean"
},
"nesteddocs" : {
"type":"nested",
"properties" : {
"dockey" : {
"type" : "long"
},
"docvalue" : {
"type" : "double"
}
}
}
}
}
}
}
}'
$ curl -XPOST 'http://localhost:9200/testdb/testtable' -d '{
"id": 1,
"parentid": 11,
"prop1": 1,
"prop2": 2,
"checkflag": "true",
"nesteddocs": [{
"dockey": 100,
"docvalue": 111
},
{
"dockey": 200,
"docvalue": 121
},
{
"dockey": 300,
"docvalue": 131
}
]
}'
$ curl -XPOST 'http://localhost:9200/testdb/testtable' -d '{
"id": 2,
"parentid": 22,
"prop1": 1,
"prop2": 2,
"checkflag": "true",
"nesteddocs": [{
"dockey": 100,
"docvalue": 211
},
{
"dockey": 200,
"docvalue": 221
},
{
"dockey": 300,
"docvalue": 231
}
]
}'
$ curl -XPOST 'http://localhost:9200/testdb/testtable' -d '{
"id": 3,
"parentid": 33,
"prop1": 1,
"prop2": 2,
"checkflag": "false",
"nesteddocs": [{
"dockey": 100,
"docvalue": 311
},
{
"dockey": 200,
"docvalue": 321
},
{
"dockey": 300,
"docvalue": 331
}
]
}'
$ curl -XPOST 'http://localhost:9200/testdb/testtable' -d '{
"id": 4,
"parentid": 44,
"prop1": 1,
"prop2": 3,
"checkflag": "true",
"nesteddocs": [{
"dockey": 400,
"docvalue": 411
},
{
"dockey": 500,
"docvalue": 421
},
{
"dockey": 600,
"docvalue": 431
}
]
}'
$ curl -XPOST 'http://localhost:9200/testdb/testtable' -d '{
"id": 5,
"parentid": 55,
"prop1": 2,
"prop2": 3,
"checkflag": "true",
"nesteddocs": [{
"dockey": 700,
"docvalue": 511
},
{
"dockey": 800,
"docvalue": 521
},
{
"dockey": 900,
"docvalue": 531
}
]
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment