How to set the id when Spark inserts Es?

When we insert data into Es, when we don’t insert the id ourselves, Es will automatically generate a random id for us, sometimes it’s not convenient for us to query, as shown in the figure below:
Insert picture description hereThen we will wonder if it is inserting, _id = 6, Can it be inserted? **Pro-test not possible: **Please see the above figure "6" will generate a separate column.
Then the specific solution is as follows: In fact, the method is very simple. We only need to specify the mapped field of _id when saving the index of Es. The details are as follows:
Insert picture description here

Guess you like

Origin blog.csdn.net/zhangyupeng0528/article/details/109555853