Fix test failures.

This commit is contained in:
Isabel Drost-Fromm 2016-05-12 12:29:18 +02:00
parent 85f1ab44d9
commit 6d5e24726f
3 changed files with 61 additions and 44 deletions

View File

@ -10,7 +10,7 @@ GET /_search
{
"query": {
"bool" : {
"query" : {
"must": {
"geo_polygon" : {
"person.location" : {
"points" : [
@ -59,9 +59,6 @@ GET /_search
"query": {
"bool" : {
"must" : {
"match_all" : {}
},
"filter" : {
"geo_polygon" : {
"person.location" : {
"points" : [
@ -90,19 +87,16 @@ GET /_search
"query": {
"bool" : {
"must" : {
"match_all" : {}
},
"filter" : {
"geo_polygon" : {
"person.location" : {
"points" : [
"40, -70",
"geo_polygon" : {
"person.location" : {
"points" : [
"40, -70",
"30, -80",
"20, -90"
]
}
]
}
}
}
}
}
}
@ -119,19 +113,16 @@ GET /_search
"query": {
"bool" : {
"must" : {
"match_all" : {}
},
"filter" : {
"geo_polygon" : {
"person.location" : {
"points" : [
"drn5x1g8cu2y",
"geo_polygon" : {
"person.location" : {
"points" : [
"drn5x1g8cu2y",
"30, -80",
"20, -90"
]
}
]
}
}
}
}
}
}

View File

@ -12,10 +12,12 @@ will work with:
--------------------------------------------------
PUT /my_index
{
"type1" : {
"properties" : {
"obj1" : {
"type" : "nested"
"mappings": {
"type1" : {
"properties" : {
"obj1" : {
"type" : "nested"
}
}
}
}
@ -33,19 +35,15 @@ GET /_search
"query": {
"nested" : {
"path" : "obj1",
"score_mode" : "avg",
"query" : {
"bool" : {
"must" : [
{
"match" : {"obj1.name" : "blue"}
},
{
"range" : {"obj1.count" : {"gt" : 5}}
}
]
}
"score_mode" : "avg",
"query" : {
"bool" : {
"must" : [
{ "match" : {"obj1.name" : "blue"} },
{ "range" : {"obj1.count" : {"gt" : 5}} }
]
}
}
}
}
}

View File

@ -3,32 +3,60 @@
added[5.0.0]
The `parent_id` query can be used to find child documents which belong to a particular parent:
The `parent_id` query can be used to find child documents which belong to a
particular parent. Given the following mapping definition:
[source,js]
--------------------------------------------------
PUT /my_index
{
"parent_id" : {
"type" : "blog_tag",
"id" : "1"
"mappings": {
"blog_post": {
"properties": {
"name": {
"type": "keyword"
}
}
},
"blog_tag": {
"_parent": {
"type": "blog_post"
},
"_routing": {
"required": true
}
}
}
}
--------------------------------------------------
// CONSOLE
// TESTSETUP
[source,js]
--------------------------------------------------
GET /_search
{
"query": {
"parent_id" : {
"type" : "blog_tag",
"id" : "1"
}
}
}
--------------------------------------------------
// CONSOLE
The above is functionally equivalent to using the following
<<query-dsl-has-parent-query, `has_parent`>> query, but performs
better as it does not need to do a join:
[source,js]
--------------------------------------------------
GET /_search
GET /my_index/_search
{
"query": {
"has_parent": {
"type": "blog",
"type": "blog_post",
"query": {
"term": {
"_id": "1"