Skip to content

Instantly share code, notes, and snippets.

Created July 1, 2013 01:34
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 anonymous/5897829 to your computer and use it in GitHub Desktop.
Save anonymous/5897829 to your computer and use it in GitHub Desktop.
curl -XDELETE 'http://localhost:9200/properties'
curl -XPUT 'http://localhost:9200/properties' -d '{
"settings": {
"number_of_shards": 3
}
}
}'
curl -XPUT 'http://localhost:9200/properties/person/_mapping' -d '{
"person": {
"_parent": {
"type": "property"
}
}
}'
curl -XPOST 'http://localhost:9200/properties/property/1' -d '{
"address": "123 Fake St"
}'
curl -XPOST 'http://localhost:9200/properties/person/1?parent=1' -d '{
"fullName": "John Smith"
}'
curl -XPOST 'http://localhost:9200/properties/person/2?parent=1' -d '{
"fullName": "Bob Jones"
}'
curl -XPOST 'http://localhost:9200/properties/person/3?parent=1' -d '{
"fullName": "Rob Bardon"
}'
curl -XPOST "http://localhost:9200/properties/_refresh"
curl -XPOST 'http://localhost:9200/properties/_search?pretty=true' -d '
{
"from": 0,
"size": 10,
"query": {
"bool": {
"must": [
{
"has_parent": {
"query": {
"bool": {
"must": {
"match": {
"address": {
"query": "123 Fake St",
"type": "boolean"
}
}
}
}
},
"parent_type": "property",
"score_type": "score"
}
}
],
"should": [
{
"match": {
"fullName": {
"query": "John Smith",
"type": "boolean"
}
}
}
],
"minimum_should_match": "1"
}
},
"sort": [
{
"_score": {
"order": "desc"
}
}
]
}'
curl -XPOST 'http://localhost:9200/properties/_search?pretty=true' -d '
{
"from": 0,
"size": 10,
"query": {
"bool": {
"must": [
{
"has_parent": {
"query": {
"bool": {
"must": {
"match": {
"address": {
"query": "123 Fake St",
"type": "boolean"
}
}
}
}
},
"parent_type": "property",
"score_type": "score"
}
}
],
"should": [
{
"match": {
"fullName": {
"query": "Bob Jones",
"type": "boolean"
}
}
}
],
"minimum_should_match": "1"
}
},
"sort": [
{
"_score": {
"order": "desc"
}
}
]
}'
curl -XPOST 'http://localhost:9200/properties/_search?pretty=true' -d '
{
"from": 0,
"size": 10,
"query": {
"bool": {
"must": [
{
"has_parent": {
"query": {
"bool": {
"must": {
"match": {
"address": {
"query": "123 Fake St",
"type": "boolean"
}
}
}
}
},
"parent_type": "property"
}
}
],
"should": [
{
"match": {
"fullName": {
"query": "Bob Jones",
"type": "boolean"
}
}
}
],
"minimum_should_match": "1"
}
},
"sort": [
{
"_score": {
"order": "desc"
}
}
]
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment