小编ken*_*cny的帖子

Elasticsearch 更新索引模板

我有一个关于elasticsearch索引模板的问题,我的问题有一个场景。

为一系列索引创建一个模板,命名为templateA,并且有一些从这个模板创建的索引,命名为Index-yyyy.mm.dd2Index-yyyy.mm.dd2。一段时间后,我需要在索引中创建一些新字段,并更新templateA.

SO,如何使之前创建的索引使用新模板?请给我一些建议。非常感谢!

elasticsearch elasticsearch-indices elasticsearch-template

7
推荐指数
1
解决办法
2万
查看次数

在 chrome 扩展上下文菜单中获取选择 DOM

我尝试获取我ContextMenu在 Chrome 扩展程序中选择的 DOM 。

代码:

chrome.contextMenus.onClicked.addListener(function(info, tab){
  // the info.selectionText just the text, don not contains html.
});

chrome.contextMenus.create({
  title: "Demo",
  contexts: ["selection"],
  id: "demo"
});
Run Code Online (Sandbox Code Playgroud)

但 info.selectionText 不包含 HTML DOM。有没有办法在 Chrome 扩展 contextMenu 中获取选择 dom?。请建议。谢谢。

javascript google-chrome google-chrome-extension

3
推荐指数
1
解决办法
3213
查看次数

如何在Node.js中请求图像和输出图像

我试图获取图像并显示在网址上.我使用请求模块.

例如,我想获取图像https://www.google.com/images/srpr/logo11w.png,并显示在我的网址上http://example.com/google/logo.

或显示<img src="http://example.com/google/logo" />.

我尝试使用请求表达:

app.get("/google/logo", function(req, res) {
  request.get("https://www.google.com/images/srpr/logo11w.png", 
        function(err, result, body) {
    res.writeHead(200, {"Content-Type": "image/png"});
    res.write(body);
    res.end();
  })
})
Run Code Online (Sandbox Code Playgroud)

但响应不是图像.如何获得图像和输出?

请给我一些关于这个问题的建议.谢谢.

javascript request node.js express

2
推荐指数
1
解决办法
1万
查看次数

如何使用jQuery修改html字符串

我尝试使用jQuery来修改HTML模板.

例如:

var d = '<div class="a"><div class="b"></div><div class="c"></div></div>';

var html = $(d).find(".b").html("BBBBB");

console.log(d);   // I want to get the new html 
Run Code Online (Sandbox Code Playgroud)

在上面,我想得到

'<div class="a"><div class="b">BBBBB</div><div class="c"></div></div>'

如何实施案例?请提出建议.

html javascript jquery

1
推荐指数
1
解决办法
497
查看次数