Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Source filtering not working on kibana

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

like image 593
dufaux Avatar asked Feb 02 '26 02:02

dufaux


1 Answers

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": []
    }
  }
}
like image 131
dufaux Avatar answered Feb 03 '26 18:02

dufaux