No, with Elasticsearh you can't do join
operations easily, more details here:
There, though, is a new feature in tech preview to run look ups from one index into another:
What I meant was to combine data from different sources. Let me show an example:
Set some data
Create a cople of indices with aliases and sharing a date field name
PUT discuss-352190-server-logs
{
"aliases": {
"server-logs": {}
},
"mappings": {
"properties": {
"timestamp": { "type": "date"},
"field1": { "type": "integer"},
"field2": { "type": "keyword"}
}
}
}
PUT discuss-352190-metrics-server
{
"aliases": {
"server-metrics": {}
},
"mappings": {
"properties": {
"timestamp": { "type": "date"},
"field3": { "type": "integer"},
"field4": { "type": "keyword"}
}
}
}
POST discuss-352190-server-logs/_bulk
{ "index": {}}
{ "timestamp": "2023-12-01", "field1": 1, "field2": "foo"}
{ "index": {}}
{ "timestamp": "2023-12-02", "field1": 2, "field2": "foo"}
{ "index": {}}
{ "timestamp": "2023-12-02", "field1": 2, "field2": "bar"}
{ "index": {}}
{ "timestamp": "2023-12-03", "field1": 1, "field2": "bar"}
{ "index": {}}
{ "timestamp": "2023-12-03", "field1": 5, "field2": "foobar"}
POST discuss-352190-metrics-server/_bulk
{ "index": {}}
{ "timestamp": "2023-12-01", "field3": 1, "field4": "foo"}
{ "index": {}}
{ "timestamp": "2023-12-01", "field3": 3, "field4": "bar"}
{ "index": {}}
{ "timestamp": "2023-12-02", "field3": 3, "field4": "bar"}
{ "index": {}}
{ "timestamp": "2023-12-02", "field3": 1, "field4": "bar"}
{ "index": {}}
{ "timestamp": "2023-12-03", "field3": 1, "field4": "bar"}
Create a data view for server-*
See how the string server-*
matches aliased indices using the $ function to query the fields API
Add a runtime field that takes the value of field1
or field3
and exposes it as unified_integer
:
Add also a filter to remove from the data view the original fields
Explore in discover
Now in Discover you get a Data View that shows only integrated data from different sources:
Does this help?