Skip to content

How to specify "fields" in Elasticsearch request "SearchSource" struct #1454

@bjur

Description

@bjur

Which version of Elastic are you using?

[x ] elastic.v7 (for Elasticsearch 7.x)
[ ] elastic.v6 (for Elasticsearch 6.x)
[ ] elastic.v5 (for Elasticsearch 5.x)
[ ] elastic.v3 (for Elasticsearch 2.x)
[ ] elastic.v2 (for Elasticsearch 1.x)

Please describe the expected behavior

I would like to achieve the following:
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-fields.html

However looking at the SearchSource struct I can only specify "doc_value" fields and "stored_fields" however I can't seem to find how to specify just "fields" field e.g. from the ES example:

POST my-index-000001/_search
{
"query": {
"match": {
"message": "foo"
}
},
"fields": ["user.id", "@timestamp"],
"_source": false
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions