Commit 6de16599 by Sxy

fix: 索引更改

parent 62c66c80
......@@ -19,7 +19,7 @@ router.post('/list', async (ctx, next) => {
}
console.log(JSON.stringify(query))
const data = await es.search({
index: "test4",
index: "trademark",
body: query
})
const { body: { hits: { total, hits } } } = data;
......
......@@ -9,13 +9,13 @@ async function start() {
let i = 0;
while (where) {
try {
const data = await Name.find(where).sort({ _id: 1 }).limit(10000);
const data = await Name.find(where).sort({ _id: 1 }).limit(1000);
if (data.length > 0) {
let array = []
console.log(i++)
console.log("1:", data[0]._id)
for (let val of data) {
array.push({ "index": { "_index": "trademark" } }, {
array.push({ "index": { "_index": "trademarkv1" } }, {
name: val.name.trim(),
length: val.name.trim().length,
cnlength: val.name.trim().replace(/[^\u4E00-\u9FA5]/g, '').length,
......@@ -24,7 +24,7 @@ async function start() {
})
}
await es.bulk({
index: "trademark",
index: "trademarkv1",
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