Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PUT my_index
- {
- "mappings": {
- "my_parent": {},
- "my_child": {
- "_parent": {
- "type": "my_parent"
- }
- }
- }
- }
- PUT my_index/my_parent/1
- {
- "text": "This is a parent document"
- }
- PUT my_index/my_child/2?parent=1
- {
- "text": "This is a child document"
- }
- PUT my_index/my_child/3?parent=1&refresh=true
- {
- "text": "This is another child document"
- }
- GET my_index/my_parent/_search
- {
- "query": {
- "has_child": {
- "type": "my_child",
- "query": {
- "match": {
- "text": "child document"
- }
- }
- }
- }
- }
- GET my_index/my_child/_search
- {
- "query": {
- "has_parent": {
- "parent_type": "my_parent",
- "query": {
- "match": {
- "text": "parent"
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment