How can I query on a date range in an array...?

The format we are looking to load into elasticsearch is...

_source.publish_date['timestamp'];

there is also a

_source.publish_date['datetime'];

But I was trying to figure out how I could do a date range query on the timestamp.

If the timestamp was a simple field I think that the query might look like this (elasticsearch npm)

client.search({
 index: 'articles',
 type: '',
 body: {
   "query": {
     "range" : {
       "datetime" : {
         "gte": "2019-01-13||/d",
         "lte": "2019-03-14||/d",
         "format": "yyyy-MM-dd"
       }
     }
   }
 }
 
}).then(function(resp) {

but with the source data set as an array would it looks like this

"range" : {
       "publish_date['datetime']" : {
         "gte": "2019-01-13||/d",
         "lte": "2019-03-14||/d",
         "format": "yyyy-MM-dd"
       }
     }

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.