Query/Filter on Complex Object, Multiple Values


(Ron) #1

I'm not sure that this is possible, have not found anything so figured I'd toss it out to the community.

Suppose I have data that has a date/time component as well as a separate value, something like this:

{ 
   "values": [
      { "date": "2015-01-01T12:34:56", "value": "apple" },
      { "date": "2011-05-05T14:50:00", "value": "orange" },
      { "date": "2009-09-09T09:32:38", "value": "banana" }
  ] }

Or something like that. if I wanted to set up a query that took into account both the 'date' and 'value' attributes of an individual value object, is that possible?

Meaning say I wanted to run a query that returned documents with value of apple and date greater than the year 2014, it should return the above document because it has a single values[] entry containing that, but if I ran the same type of query with a value of apple and date less than the year 2014 it should not return the above document because those values don't exist in the same object.

Is that even possible? I don't think it is, but I figured it doesn't hurt to ask.


(Mark Harwood) #2

See nested doc support

https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-nested-type.html


(system) #3