Open occultskyrong opened 5 years ago
解决vscode
中beautify
插件中析构赋值换行的格式化问题
Indices created in Elasticsearch 6.0.0 or later may only contain a single mapping type.
Indices created in 5.x with multiple mapping types will continue to function as before in Elasticsearch 6.x.
Mapping types will be completely removed in Elasticsearch 7.0.0.
为什么ElasticSearch要在7.X版本去掉type?
Elasticsearch 6.0 Removal of mapping types
Elasticsearch Reference [6.x] » Mapping » Removal of mapping types
Indices, types, and parent / child: current status and upcoming changes in Elasticsearch
Elasticsearch 5.6.0
Setting index.mapping.single_type: true on an index will enable the single-type-per-index behaviour which will be enforced in 6.0.
The join field replacement for parent-child is available on indices created in 5.6.
Elasticsearch 6.x
Indices created in 5.x will continue to function in 6.x as they did in 5.x.
Indices created in 6.x only allow a single-type per index. Any name can be used for the type, but there can be only one. The preferred type name is _doc, so that index APIs have the same path as they will have in 7.0: PUT {index}/_doc/{id} and POST {index}/_doc
The _type name can no longer be combined with the _id to form the _uid field. The _uid field has become an alias for the _id field.
New indices no longer support the old-style of parent/child and should use the join field instead.
The default mapping type is deprecated.
Elasticsearch 7.x
The type parameter in URLs are deprecated. For instance, indexing a document no longer requires a document type. The new index APIs are PUT {index}/_doc/{id} in case of explicit ids and POST {index}/_doc for auto-generated ids.
The index creation, GET|PUT _mapping and document APIs support a query string parameter (include_type_name) which indicates whether requests and responses should include a type name. It defaults to true. 7.x indices which don’t have an explicit type will use the dummy type name _doc. Not setting include_type_name=false will result in a deprecation warning.
The default mapping type is removed.
Elasticsearch 8.x
The type parameter is no longer supported in URLs.
The include_type_name parameter is deprecated, default to false and fails the request when set to true.
Elasticsearch 9.x
The include_type_name parameter is removed.
https://alexmarquardt.com/2018/07/23/deduplicating-documents-in-elasticsearch/
或
terms aggs
聚合出重复项,top_hits
取前n个,aggs
结果则重复已删除完布隆过滤
--no-autorestart
https://github.com/Unitech/pm2/issues/2286
并发+同步(promise)
const Benchmark = require('benchmark');
const mongoose = require('mongoose');
const { mongodb } = require('../../config');
mongoose.connect(`mongodb://${mongodb.host}:${mongodb.port}/transaction`, {
useNewUrlParser: true,
poolSize: 10,
});
const { Schema } = mongoose;
const db = mongoose.connection;
const Log = db.model('Log', new Schema({ timestamp: Date }));
async function createLog(session) {
if (session) {
await Log.create({ timestamp: new Date().getTime() }, { session });
} else {
await Log.create({ timestamp: new Date().getTime() });
}
return true;
}
// 直接创建
const create = deferred => Log
.createCollection()
.then(() => createLog())
.then(() => deferred.resolve());
// 使用事务创建
const transacion = (deferred) => {
let session;
return Log
.createCollection()
.then(() => db.startSession())
.then((_session) => {
session = _session;
session.startTransaction();
return createLog(session);
})
.then(() => session.commitTransaction())
.then(() => deferred.resolve());
};
const suite = new Benchmark.Suite();
async function run() {
// add tests
suite
.add('transaction', transacion, { defer: true })
.add('create', create, { defer: true })
.on('cycle', event => console.info(String(event.target)))
.on('complete', () => console.info('--- Completed ---'))
// run async
.run({ async: true });
}
run()
.then()
.catch(console.error);
待归档issue列表