Dolgy
November 23, 2017, 12:27pm
1
Hy, I'm trying to exclude one field from my data and is working wrong on ES 6
Query
GET /warehouses/doc/_search
{
"query": {
"bool": {
"must": {
"match_all": {}
}
}
},
"_source": {
"excludes": [
"user.active"
]
}
}
Excluding field "active" from user with data like this is working perfectly:
{
"active": true,
"warehouse": "London",
"user": ["active":true,"name":"Mike"]
}
RESULT
{
"active": true,
"warehouse": "London",
"user": ["name":"Mike"]
}
When user is empty, ES 6 dont work well, removes it:
{
"active": true,
"warehouse": "London",
"user": []
}
RESULT
{
"active": true,
"warehouse": "London"
}
dadoonet
(David Pilato)
November 23, 2017, 2:06pm
2
I don’t think there is a way to prevent that.
Dolgy
November 23, 2017, 3:15pm
3
@dadoonet , on ES 5 it works well.
dadoonet
(David Pilato)
November 23, 2017, 3:52pm
4
Oh?
I think @tanguy might know.
Dolgy
November 27, 2017, 8:03am
5
Thx @dadoonet
@tanguy , can you follow this post and tell me something, please.
tanguy
(Tanguy)
November 27, 2017, 8:37am
6
POST /test/doc/0
{
"active": true,
"warehouse": "London",
"user": ["active":true,"name":"Mike"]
}
is not a valid JSON content and fails on 5.4, 5.6 and 6.0.
Are you using nested documents? If so can you please post the mapping you are using?
Dolgy
November 27, 2017, 3:02pm
7
@tanguy , use this data:
POST /test/doc/0
{
"active": true,
"warehouse": "London",
"user": [
{
"active": true,
"name": "Mike"
},
{
"active": true,
"name": "Jimmy"
}
]
}
POST /test/doc/1
{
"active": true,
"warehouse": "London",
"user": []
}
GET /test/doc/_search
{
"query": {
"bool": {
"must": {
"match_all": {}
}
}
},
"_source": {
"excludes": [
"user.active"
]
}
}
system
(system)
Closed
December 25, 2017, 3:03pm
8
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.