Skip to content

Support * wildcard to retrieve stored fields #10783

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
lvernaillen opened this issue Apr 24, 2015 · 1 comment
Closed

Support * wildcard to retrieve stored fields #10783

lvernaillen opened this issue Apr 24, 2015 · 1 comment
Labels
>enhancement good first issue low hanging fruit help wanted adoptme :Search/Search Search-related issues that do not fall into other categories

Comments

@lvernaillen
Copy link

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" }
    }
}
@clintongormley clintongormley added >enhancement good first issue low hanging fruit help wanted adoptme :Search/Search Search-related issues that do not fall into other categories labels Apr 26, 2015
@clintongormley
Copy link
Contributor

Agreed. Btw, using _source is the preferred way of doing this, rather than using stored fields to store all of your fields a second time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>enhancement good first issue low hanging fruit help wanted adoptme :Search/Search Search-related issues that do not fall into other categories
Projects
None yet
Development

No branches or pull requests

2 participants