alxv
alxv

Reputation: 115

Elasticsearch Range Query with wildcard in field name

I have a simple range query:

{
"query": {
    "range": {
        "unified_source.step_11.sizeIncome":  {
             "gte" : 10
        }
    }
}

}

But I need to apply this query to all nested objects, like this:

{
"query": {
    "range": {
        "unified_source.*.sizeIncome":  {
             "gte" : 10
        }
    }
}

}

This returns no hits.

Is that possible to use some wildcard there?

Can I 'combine' that query with Query String Query somehow? (In Query String wildcard can be used to search "within" specific inner elements of the document).

Thanks

Upvotes: 0

Views: 1097

Answers (1)

Val
Val

Reputation: 217294

Yes, you can do range queries in a query_string query like this:

{
    "query": {
        "query_string": {
            "query": "unified_source.*.sizeIncome:>=10"
        }
    }
}

Upvotes: 2

Related Questions