Skip to main content

Posts

Showing posts from January, 2019

rename field in elastic Search

https://qiita.com/tkprof/items/e50368eb1473497a16d0 How to Rename an Elasticsearch field from columns: - {name: xxx, type: double} to columns: - {name: yyy, type: double} Pipeline API and reindex create a new Pipeline API : Rename Processor PUT _ingest/pipeline/pipeline_rename_xxx { "description" : "rename xxx", "processors" : [ { "rename": { "field": "xxx", "target_field": "yyy" } } ] } { "acknowledged": true } then reindex POST _reindex { "source": { "index": "source" }, "dest": { "index": "dest", "pipeline": "pipeline_rename_xxx" } }

Learn about promise and q in node js

Good Link to study promises in node https://www.youtube.com/watch?v=s6SH72uAn3Q Use-cases of promises and reasons to switch to promises https://spion.github.io/posts/why-i-am-switching-to-promises.html Sample program with q and promises  const {PythonShell} =  require('python-shell'); var Q = require('q'); var Promise = require('promise'); var pk = function runPythonShell(){ return  Q.Promise(function(resolve, reject){ PythonShell.runString('x=1+1;print(x)', null, function(err , result){ if(err){ reject(err); }else{         console.log("result " + result); resolve("finshed"); } }) }); } Q.fcall(pk) .then(function (value4) {     // Do something with value4     console.log("lola next"); }) .catch(function (error) {     // Handle any error from all above steps     console.log("there is some error");     console.log(error); }) .done();