Commit bbfae147 by Sxy

fix: 修改索引

parent ce159a47
实现商标近似查询
\ No newline at end of file
...@@ -5,9 +5,6 @@ const es = require("../client/esclient"); ...@@ -5,9 +5,6 @@ const es = require("../client/esclient");
*/ */
async function start() { async function start() {
let where = { let where = {
_id: {
$gt: "611d4f9895c286d09c699513"
}
} }
let i = 0; let i = 0;
while (where) { while (where) {
...@@ -18,7 +15,7 @@ async function start() { ...@@ -18,7 +15,7 @@ async function start() {
console.log(i++) console.log(i++)
console.log("1:", data[0]._id) console.log("1:", data[0]._id)
for (let val of data) { for (let val of data) {
array.push({ "index": { "_index": "test3" } }, { array.push({ "index": { "_index": "trademark" } }, {
name: val.name.trim(), name: val.name.trim(),
length: val.name.trim().length, length: val.name.trim().length,
cnlength: val.name.trim().replace(/[^\u4E00-\u9FA5]/g, '').length, cnlength: val.name.trim().replace(/[^\u4E00-\u9FA5]/g, '').length,
...@@ -27,7 +24,7 @@ async function start() { ...@@ -27,7 +24,7 @@ async function start() {
}) })
} }
await es.bulk({ await es.bulk({
index: "test3", index: "trademark",
body: array body: array
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment