小编ade*_*ura的帖子

将csv导入elasticsearch

我正在做"弹性搜索入门"教程.不幸的是,本教程未涵盖将csv数据库导入elasticsearch的第一步.

我用谷歌搜索解决方案,但不幸的是它不起作用.这是我想要实现的和我拥有的:

我有一个包含我要导入的数据的文件(简化)

id,title
10,Homer's Night Out
12,Krusty Gets Busted
Run Code Online (Sandbox Code Playgroud)

我想用它导入它logstash.通过互联网研究后,我最终得到以下配置:

input {
    file {
        path => ["simpsons_episodes.csv"]
        start_position => "beginning"
    }
}

filter {
    csv {
        columns => [
            "id",
            "title"
        ]
    }
}

output {
    stdout { codec => rubydebug }
    elasticsearch {
        action => "index"
        hosts => ["127.0.0.1:9200"]
        index => "simpsons"
        document_type => "episode"
        workers => 1
    }
}
Run Code Online (Sandbox Code Playgroud)

我在指定文档类型时遇到问题,因此一旦导入数据并导航到http:// localhost:9200/simpsons/episode/10我希望看到第10集的结果.

csv import elasticsearch logstash

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

在JSON模式中定义另一个选项时,需要使用可选选项

我想定义certificateprivateKey在需要时secure标志设置为true.这有可能实现吗?

{
    type: 'object',
    properties: {
        'secure': {
            title: 'Serve files over HTTPS',
            description: 'Flag telling whether to serve contents over HTTPS and WSS',

            type: 'boolean',
            default: false
        },

        'certificate': {
            title: 'Certificate file',
            description: 'Location of the certificate file',

            type: 'string'
        },

        'privateKey': {
            title: 'Private key file',
            description: 'Location of the private key file',

            type: 'string'
        }
}
Run Code Online (Sandbox Code Playgroud)

json jsonschema

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

使用socket.io nodejs提供自定义静态文件

我尝试在服务器和客户端之间共享我的代码我使用以下代码(app.js):

var io = require('socket.io').listen(8000), 
  Static = require('socket.io').Static; 

io.configure(function () {
  var _static = new Static(io); 

  // some methods to add my custom files 

  _static.add('\public\test.js');
  io.set('static', _static);
});
Run Code Online (Sandbox Code Playgroud)

我的文件结构如下所示:

    • app.js
    • 上市
      • test.js

当我输入"http:// localhost:8000/public.test.js"浏览器下载默认文件"Welcome to socket.io"

static share node.js socket.io

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

标签 统计

csv ×1

elasticsearch ×1

import ×1

json ×1

jsonschema ×1

logstash ×1

node.js ×1

share ×1

socket.io ×1

static ×1