I have an index name indextest and I want to write an ESSQL which checks on a id field value in all documents in an indextest and return single row for all mapping documents.
For example -
**sample document in index**:
Doc 1
{
"index" : "indextest",
"empid" : 1,
"empname: "ABC",
"uniqueid" : "011"
}
Doc 2
{
"index" : "indextest",
"empid" : 2,
"empname: "DEF",
"A.uniqueid" : "012"
}
Doc 3
{
"index" : "indextest",
"empposition" : "developer",
"empworklocation: "WFH",
"B.uniqueid" : "012"
}
**ESSQL**
SELECT "empid" as id, "empname" as name , "empposition" as designation, "empworklocation" as worklocation FROM "indextest" WHERE "A.uniqueid" == "B.uniqueid"
**Desire result from ESSQL is** :
{
"empid" : 1,
"empname: "ABC",
"empposition" : "developer",
"empworklocation: "WFH"
}
Can someone please assist me with correct ESSQL (if it is possible to join two documents in ES)?