ElasticSearch - search for any nested field that is in range ElasticSearch - search for any nested field that is in range elasticsearch elasticsearch

ElasticSearch - search for any nested field that is in range


You could start with a query string like:

GET test1/_search{  "query": {    "query_string": {      "default_field": "PayPlan.ActivePlans.plan*.startsOn",      "query":  ">0"    }  }}

The output (with a quick test run):

{  "took": 2,  "timed_out": false,  "_shards": {    "total": 5,    "successful": 5,    "failed": 0  },  "hits": {    "total": 2,    "max_score": 1,    "hits": [      {        "_index": "test1",        "_type": "plan",        "_id": "AVq000G1mKJs7uLU8liY",        "_score": 1,        "_source": {          "PayPlan": {            "ActivePlans": {              "plan2": {                "startsOn": "2",                "endsOn": "999998"              }            }          }        }      },      {        "_index": "test1",        "_type": "plan",        "_id": "AVq00p0pmKJs7uLU8liW",        "_score": 1,        "_source": {          "PayPlan": {            "ActivePlans": {              "plan1": {                "startsOn": "1",                "endsOn": "999999"              }            }          }        }      }    ]  }}