Skip to content

Instantly share code, notes, and snippets.

@imotov
Created June 4, 2012 12:16
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 imotov/2868005 to your computer and use it in GitHub Desktop.
Save imotov/2868005 to your computer and use it in GitHub Desktop.
#!/bin/bash
curl -XDELETE http://localhost:9200/test-orders
curl -XPUT http://localhost:9200/test-orders -d '{
"mappings" : {
"copy_order_snapshot": {
"properties": {
"line_item_info": {
"dynamic": "true",
"properties": {
"m_product_details": {
"dynamic": "true",
"properties": {
"accessories_colour": {
"type": "string"
},
"status": {
"type": "string"
}
}
},
"other_details": {
"dynamic": "true",
"properties": {
"accessories_material_type": {
"type": "string"
},
"status": {
"type": "string"
}
}
}
}
}
}
}
}
}'
echo
curl -XPUT http://localhost:9200/test-orders/copy_order_snapshot/1 -d '{
"line_item_info" : {
"other_details" : {
"status" : "enabled"
},
"m_product_details" : {
"status" : "1"
}
}
}'
echo
curl -XPOST http://localhost:9200/test-orders/_refresh
echo
# Doesn't return any results:
curl -XGET http://localhost:9200/test-orders/copy_order_snapshot/_search -d '{
"query":{
"term":{
"status":"1"
}
}
}'
echo
# Returns a results:
curl -XGET http://localhost:9200/test-orders/copy_order_snapshot/_search -d '{
"query":{
"term":{
"status":"enabled"
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment