Skip to content

Support * wildcard to retrieve stored fields #10783

Closed
@lvernaillen

Description

@lvernaillen

Currently you can retrieve stored fields of a search hit using the fields option.
However you cannot use wildcards.

Suppose I have document with several title fields such as "book_title", "chapter_title", "paragraph_title", "section_title" and I want to have all those title fields returned from a query.

It would be nice to have something like this:

{
    "fields" : [ "*_title" ],
    "query" : {
        "term" : { "category" : "quote" }
    }
}

No need to specify all the fields and when new title fields are added they are automatically returned.
Wildcard * is already supported when specifying the fields in a multi_match query or when specifying the fields to highlight for example.

A current workaround is using source-filtering, which does allow the * wildcard.

{
    "_source": "*_title" ,
    "query" : {
        "term" : { "category" : "quote" }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions