I am new to elasticsearch and i am having tough time switching from mysql to elasticsearch
my Mysql my tables looks like this
table : test_request +---------+-------------+--------------+-----------+------------+-----------+ | test_id | device_name | ip_address | user_name | time_stamp | show_flag | +---------+-------------+--------------+-----------+------------+-----------+ | 1 | d1 | 0.0.0.0 | admin | | Y | +---------+-------------+--------------+-----------+------------+-----------+
table: test_results +----+---------+-----+-----------------------+-------------------------+----------------------------------+-----------+ | id | test_id | cli | xml | json | another json | show_flag | +----+---------+-----+-----------------------+-------------------------+----------------------------------+-----------+ | 1 | 1 | c1 | some xml format data | {"some":"json here"} | {"some":" another json here"} | Y | +----+---------+-----+-----------------------+-------------------------+----------------------------------+-----------+ | 2 | 1 | c2 | some xml format data | {"some":"json here"} | {"some":" another json here"} | Y | +----+---------+-----+-----------------------+-------------------------+----------------------------------+-----------+ | 3 | 1 | c2 | some xml format data | {"some":"json here"} | {"some":" another json here"} | Y | +----+---------+-----+-----------------------+-------------------------+----------------------------------+-----------+
the test_id
field in the test_request
table and the id
field in the test_results
table are auto increment
.
The json
and another json
fields are of data type JSON
.
I am trying to use elasticsearch_dsl
to create index and its mappings. I am going through the docs to figure out how to do achieve this but i couldn't figure out three things
- how to get the test_id to
auto increment
- how to make a field of
JSON
data type - Best way to setup a relationship between both (i partially understood nested could help here) but looking for the correct way to do this