Is there a way to exclude a field in an Elasticsearch query

You can use Source Filtering (Tested in v. 1.6 and v. 1.7): https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-source-filtering.html

{
    "_source": {
        "include": [ "obj1.*", "obj2.*" ],
        "exclude": [ "*.description" ]
    },
    "query" : {
        "term" : { "user" : "kimchy" }
    }
}

You can also use it in GET request:

curl "localhost:9200/myindex/mytype/66a8f299870b4cab?_source_exclude=file._content&pretty"

The previous example exclude the file content in an attachment field.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)