When data is inserted in large amounts, the efficiency is particularly slow

N1QL is very inefficient when performing insert operations.
For example, I insert nearly 300,000 pieces of data into the database, which takes about 20 minutes to complete.

CE version of query service only uses 4 cores. You should use EE version or directly insert data using SDKs to avoid 2 hops. Also use bulk insert and prepare statements as described in Performance section of insert statement.