小编Sun*_*man的帖子

如何从Visual Studio 2017预览版2指定Azure功能的输出绑定?

在Azure门户中,可以从该功能的"集成"页面轻松配置Azure功能的输出绑定.这些设置最终进入function.json.

从Azure门户指定输出绑定

我的问题是,如何从Visual Studio中设置这些值?代码如下所示:

public static class SomeEventProcessor
{
    [FunctionName("SomeEventProcessor")]

    public static async Task<HttpResponseMessage> Run(
        [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequestMessage req,
        TraceWriter log,
        IAsyncCollector<EventInfo> outputQueue)
    {
        log.Info("C# HTTP trigger function processed a request.");

        EventInfo eventInfo = new EventInfo(); //Just a container
        eventInfo.SomeID = req.Headers.Contains("SomeID") ? req.Headers.GetValues("SomeID").First() : null;

        //Write to a queue and promptly return
        await outputQueue.AddAsync(eventInfo);

        return req.CreateResponse(HttpStatusCode.OK);

    }
}
Run Code Online (Sandbox Code Playgroud)

我想指定从VS使用哪个队列和哪个存储,以便我可以控制我的代码和配置.我已经检查了类似的问题,建议的问题等,但没有一个被证明是方便的.

我正在使用Visual Studio 2017预览版,15.3.0预览版3

VS Extension:VS的Azure函数工具,版本0.2

c# azure azure-functions visual-studio-2017

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

如何验证 Elasticsearch Painless 脚本?

我们在项目中使用了许多ScriptQuery和ScriptField ,并以轻松的语言为它们提供了内联脚本。

我的问题是,我们如何验证这些轻松的脚本?换句话说,如何确保它们能够编译?

我们今天使用的方法是通过 Kibana 在本地测试它们。然而,这是手动的,容易出错且不可扩展。我正在寻找一种编程方式或实用程序来验证无痛脚本,以便我可以将其插入 CI/CD 管道中。Elasticsearch 底层使用的编译器是开源的吗?或者还有其他办法吗?

Elasticsearch 版本 5.4

Kibana 中的示例查询,带有用于 ScriptField 和 ScriptQuery 的 Painless 脚本

GET myIndex/_search
{
  "script_fields": {
    "LastName": {
      "script": {
        "inline": "if(doc['Author']!= null && doc['Author'].value != null){return doc['Author'].value.toUpperCase();}return null;",
        "lang": "painless"
      }
    }
  },
  "query": {
    "bool": {
      "must_not": [
        {
          "bool": {
            "must": [
              {
                "script": {
                  "script": {
                    "inline": "def lastName = '';if(doc['Author']!= null && doc['Author'].value != null){lastName = doc['Author'].value.toUpperCase();}if(doc.containsKey('LastName') && doc['LastName']!= null && doc['LastName'].value != …
Run Code Online (Sandbox Code Playgroud)

compilation elasticsearch kibana elasticsearch-5 elasticsearch-painless

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