Reputation: 4669
I have a set of documents indexed in elasticsearch that have a bunch of data, but two styles with differentiated fields.
The first has a style like this:
{
type: "measurement",
startTime: "iso-time-goes-here",
duration: 30, // seconds
locationId: "abc"
}
The second has a style like this:
{
type: "event",
startTime: "iso-time-goes-here",
locationId: "abc"
}
The rest of the fields is identical between the documents.
I want to run a search such as "Show me all event
documents where there is a measurement
document less than 1 minute away from it and the locationId
s match"
Is such a query possible in elasticsearch? How can I pull this off?
Upvotes: 0
Views: 49
Reputation: 8314
No, Elasticsearch has no joins, which is what you would need here since you are joining measurements with events on the locationId.
Maybe you can denormalize measurements into events at index time and then you have the information there. If you can manage this, that would be the fastest. Anything else like doing multiple queries and then filtering your result set is likely to get expensive; which is the reason why Elasticsearch does not support joins. But from what you describe that won't work for you likely.
Upvotes: 1