小编use*_*035的帖子

Elasticsearch对特定索引的查询

我已经在2天后搜索了这个.我使用sense chrome插件来测试我的查询,但我找不到如何指定他应该搜索哪个索引.所以我的查询搜索所有索引,并不容易使用.

我尝试了以下语法:

GET _search
{
    "query": {
        "term": {
           "_index": {
              "value": "dev_events2"
           }
        }
    }

}

GET _search
{
    "_index": "dev_events2",
    "query": {
        "match_all" : {  }
    }

}

GET _search
{
    "index": "dev_events2",
    "query": {
        "match_all" : {  }
    }

}
Run Code Online (Sandbox Code Playgroud)

问候,

本杰明五世


编辑我终于找到了答案:只需将索引名称添加到get:localhost:9201/myIndexName的url中

indexing syntax elasticsearch sense

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

如何下载文件? - Groovy

我需要下载一个文件(例如这个:https://www.betaseries.com/srt/391160),所以我在网上找到了不同的方法:

def download(String remoteUrl, String localUrl)
{
    def file = new FileOutputStream(localUrl)
    def out = new BufferedOutputStream(file)
    out << new URL(remoteUrl).openStream()
    out.close()
}
Run Code Online (Sandbox Code Playgroud)

要么

def download(String remoteUrl, String localUrl) {
  new File("$localUrl").withOutputStream { out ->
      new URL(remoteUrl).withInputStream { from ->  out << from; }
  }
}
Run Code Online (Sandbox Code Playgroud)

我看到文件已创建但文件大小总是等于1KB我该怎么办呢?

预先感谢,

本杰明

https groovy download

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

Cypress 将一个 iframe 访问到另一个 iframe 中

我正在尝试找到使用 cypress 访问 iframe 的解决方案。\n我已经尝试了以下所有功能,但没有成功:

\n
Cypress.Commands.add('getIframeBody', (iframeSelector) => {\n    // get the iframe > document > body\n    // and retry until the body element is not empty\n    return cy\n    .get(iframeSelector)\n    .its('0.contentDocument.body').should('not.be.empty')\n    // wraps "body" DOM element to allow\n    // chaining more Cypress commands, like ".find(...)"\n    // https://on.cypress.io/wrap\n    .then(cy.wrap)\n  })\n\nCypress.Commands.add('iframev3', { prevSubject: 'element' }, (iframeSelector, callback) => {\n    // For more info on targeting inside iframes refer to this GitHub issue:\n    // https://github.com/cypress-io/cypress/issues/136\n    cy.log('Getting iframe body')\n\n    return cy\n        .get(iframeSelector)\n        .wrap($iframe)\n …
Run Code Online (Sandbox Code Playgroud)

javascript cypress

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