I am trying to exclude some field with source filtering.
I create an index:
put testindex
{
"mappings": {
"type1": {
"properties":{
"name": { "type": "text" },
"age": { "type": "integer" }
}
}
}
}
insert a document:
put testindex/type1/a
{
"name":"toto",
"age":23
}
and try a filtered query:
get testindex/_search
{
"_source": {
"excludes": [ "age" ]
},
"query": {
"bool": {
"should": []
}
}
}
the result is:
"hits": [
{
"_index": "testindex",
"_type": "type1",
"_id": "a",
"_score": 1,
"_source": {
"name": "toto",
"age": 23
}
}
]
I don't understand why it does not hide the "age" field in _source.
_source: false give the same result.
I used elasticsearch & kibana 5.6
Ok I found it. It's probably due to Kibana. When I use lowercase for the "get". It does not work.
get testindex/_search
{
"_source": {
"excludes": [ "age" ]
},
"query": {
"bool": {
"should": []
}
}
}
When I use uppercase, it work. I don't really know why but that's it..
GET testindex/_search
{
"_source": {
"excludes": [ "name" ]
},
"query": {
"bool": {
"should": []
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With