Master Data Mapping in ES Result - elasticsearch

Is there any way in ES to map master data with search result.
Example:-
I have Employee and EmployeeType tables in RDBMS
EmployeeType has 2 fields - Id and EmployeeTypeName(Admin, Management, Job Level 1)
In Employee table I have mapped EmployeeTypeId (Foreign Key)
When I retrieve Employee Data I want to get EmployeeTypeName along with Id.

Related

NIFI - How to insert distinct data from the flow and refer to that data ID in other places

I'm trying to learn NIFI so this is all new to me, I used to work with Talend and I have hard time translating to NIFI. So the main idea: For example is I have two tables in Postgresql
Table CITY :
ID (auto generated), city_name
Table PERSON :
ID (auto generated), first_name, last_name, city_id
and I have a CSV file :
first_name, last_name, city_name
Can you please explain how I can insert in tow tables from one flowfile and refer in the table PERSON to the ID of the city not the name from the table CITY.
Thank you
you could use LookupRecord to enrich each record with city id and split input in two files: matched/unmatched.
for matched you have to execute simple insert into PERSON table - because city id was found.
for unmatched you have to generate insert/upsert into CITY table and then route all those records to lookup record again.
or you could insert everything as is into temp table with structure that matches your CSV.
and then execute 2 simple sql statements:
populate missing cities from temp table
insert into person from temp table with lookup city id on the level of SQL server

Are correlated sub queries supported by GraphQL

I am investigating the use of GraphQL
I have a use case which I cannot see how to achieve in a single GraphQL query.
I have the following data classes.
Type A Reference Data (Primary Key id)
Type A User Data (Foreign Key rd_id)
Type B User Data
I can execute three separate queries to retrieve all the necessary data
What I would like is to execute a single query and get all data
I can get Type A & B User data in one query fine.
However I also need the Type A Reference data returned with the associated Type A User Data.
Type A user data has a foreign key to the specific reference data row
I cannot see how I can write a GraphQL query that joins data from two separate types of data.
query experiment {
userA {
id
rd_id
name
address {
address_line_1
address_line_2
zip
}
}
userB {
id
business_name
trading_as
}
referenceData (id : $userA.rd_id) { // How can I achieve this join
type
type_name
limit
}
Does GraphQL allow me to join referenceData records to UserA type records like this in a "dynamic" way?

How to get all data for a record from table with data from another table

I have a table called reservations, and it contains room_id and person_id
i want to to make something like this
Reservation::find($id)->with(['person','room'])->get()
so it will return the all reservation info with that id , with person info and room info
any help ?
return Reservation::with("The table that contains the id")->find(id of record that looking for);

What to choose to use to determine the relationship?

I have 3 tables:
table city (500 000 records)
table post (A city can have many posts)
table post_text (To store the text of the post)
table city has fields ID, NAME
table post has fields ID, CITY_ID, POST_ID
table post_text has fields TITLE, TEXT
What to use?
Polymorphic? Through? Something else?

'include' data from two tables with same column name in single query

I have two tables(Reviews and Comments) with same column name userId, how can i differentiate them in parseQuery so i may get the data using the 'include' option, query is as follow:
query.whereEqualTo("businessId", parseBusiness);
query.include("userId"); // from the reviews table
query.include("lastComment");
query.include("userId"); // from he comments table
userId is a pointer to the User table

Resources