Skip to content

Instantly share code, notes, and snippets.

@zwrss
Last active August 29, 2015 13:58
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 zwrss/9953291 to your computer and use it in GitHub Desktop.
Save zwrss/9953291 to your computer and use it in GitHub Desktop.
curl -XGET "http://localhost:9200/parentchild/Child_english/_search" -d'
{
"query": {
"query_string": {
"query": "these are four words"
}
}
}'
curl -XGET "http://localhost:9200/parentchild/Child_english/_search" -d'
{
"query": {
"filtered": {
"query": {
"query_string": {
"query": "these are four words"
}
},
"filter": {
"term": {
"usage": "description"
}
}
}
}
}'
curl -XGET "http://localhost:9200/parentchild/Parent/_search" -d'
{
"query": {
"filtered": {
"query": {
"bool": {
"should": [
{
"query_string": {
"query": "these are four words"
}
},
{
"top_children": {
"type": "Child_english",
"query": {
"query_string": {
"query": "these are four words"
}
}
}
}
]
}
},
"filter": {
"range": {
"id": {
"from": 1000000,
"to": 1100000
}
}
}
}
}
}'
{
"parentchild": {
"mappings": {
"Child_german": {
"_parent": {
"type": "Parent"
},
"_routing": {
"required": true
},
"properties": {
"locale": {
"type": "string"
},
"text": {
"type": "string",
"analyzer": "german"
},
"usage": {
"type": "string"
}
}
},
"Child_english": {
"_parent": {
"type": "Parent"
},
"_routing": {
"required": true
},
"properties": {
"locale": {
"type": "string"
},
"text": {
"type": "string",
"analyzer": "english"
},
"usage": {
"type": "string"
}
}
},
"Child_finnish": {
"_parent": {
"type": "Parent"
},
"_routing": {
"required": true
},
"properties": {
"locale": {
"type": "string"
},
"text": {
"type": "string",
"analyzer": "finnish"
},
"usage": {
"type": "string"
}
}
},
"Child_french": {
"_parent": {
"type": "Parent"
},
"_routing": {
"required": true
},
"properties": {
"locale": {
"type": "string"
},
"text": {
"type": "string",
"analyzer": "french"
},
"usage": {
"type": "string"
}
}
},
"Child_polish": {
"_parent": {
"type": "Parent"
},
"_routing": {
"required": true
},
"properties": {
"locale": {
"type": "string"
},
"text": {
"type": "string",
"analyzer": "polish"
},
"usage": {
"type": "string"
}
}
},
"Child_spanish": {
"_parent": {
"type": "Parent"
},
"_routing": {
"required": true
},
"properties": {
"locale": {
"type": "string"
},
"text": {
"type": "string",
"analyzer": "spanish"
},
"usage": {
"type": "string"
}
}
},
"Parent": {
"properties": {
"id": {
"type": "integer"
}
}
}
}
}
}
curl -XGET "http://localhost:9200/parentchild/Parent/_search" -d'
{
"query": {
"bool": {
"should": [
{
"query_string": {
"query": "these are four words"
}
},
{
"top_children": {
"type": "Child_english",
"query": {
"query_string": {
"query": "these are four words"
}
}
}
}
]
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment