小编fed*_*edd的帖子

Elasticsearch高级休息客户端 - 带有类型(子)字段的Java Map - 日期,数字等

(从评论中复制的澄清)

我有一个java.util.Map具有不同键值对,并且一些值是日期,一些数字,一些是字符串,还有一些也java.util.Map可以包含所有类型的上述类型.我能够将它放入索引中,我看到弹性搜索映射是使用正确的字段类型自动创建的,现在我想检索它Map并查看日期,数字,字符串和嵌套Maps而不是我现在拥有的 - 只是字符串和地图

更多故事:

我正在java.util.Map使用以下代码放入Elasticsearch:

public void putMap(String key, Map<String, ?> value) {
    try {
        IndexRequest ir = Requests.indexRequest(_index)
                .id(key)
                .type("doc")
                .source(value);

        Factory.DB.index(ir); // the high level rest client here

    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
}
Run Code Online (Sandbox Code Playgroud)

我无法根据我的任务明确创建映射.

对于我的一个索引,它创建了这样的映射,这很好:

{
"rex": {
"mappings": {
  "doc": {
    "properties": {
      "variables": {
        "properties": {
          "customer": {
            "properties": {
              "accounts": {
                "properties": {
                  "dateOpen": {
                    "type": "date"
                  },
                  "id": …
Run Code Online (Sandbox Code Playgroud)

java elasticsearch

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

什么样的对象是node-postgres错误?为什么node的console.log和JSON.stringify以不同的方式处理它?

console.log像这样输出,

{ [error: syntax error at or near "step"]
  length: 86,
  name: 'error',
  severity: 'ERROR',
  code: '42601',
  detail: undefined,
  hint: undefined,
  position: '62',
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  file: 'scan.l',
  line: '1001',
  routine: 'scanner_yyerror' }
Run Code Online (Sandbox Code Playgroud)

但是JSON.stringify没有看到错误的叙述部分,

{ "长度":86, "名称": "错误", "严重性": "ERROR", "代码": "42601", "位置": "62", "文件": "scan.l里","行 ":" 1001" , "常规": "scanner_yyerror"}

我无法弄清楚如何得到这个"错误:列'未定义’不存在"读书wikies(https://github.com/brianc/node-postgres/wiki/Error-handling,HTTP://的NodeJS. ru/doc/v0.4.x/stdio.html#console.log)

代码是这样的,

   client.query(selstring, function(err, result) {
   if(err){
     res.send(JSON.stringify(err));
     console.log(err);
   }else{
Run Code Online (Sandbox Code Playgroud)

谢谢

更新:err.toString()显示error: syntax error at or near "step"

node.js node-postgres

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

如何在纯JSP中添加自定义VariableResolver

我希望以编程方式添加一个自定义的VariableResolver,当JSF或类似的东西没有使用时,所以在寻找1中提到的范围内的bean之前,EL会首先尝试解析其中的变量.

目标是使数据库中的对象可以通过其名称在EL中使用,并且可以将很多对象放入某个范围.

现在我将一个特殊的bean放在名为"z"的会话范围内,并且该bean扩展了Map接口,因此可以使用$ {z.address},$ {z.fullName}等表达式访问对象.我试图消除'z'.

如果我设法将我的解析器插入过滤器中更好(确保我会检查不要为每个Web请求多次执行此操作)

(编辑:也许我在谈论ELContext,如何放置我自己的VariableMapper或ELResolver或类似的东西)

java jsp el

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

为什么我的流复制过程稳定地降低了性能

在复制大文件期间,此代码的运行速度越来越慢。难道我做错了什么?

    InputStream ms2 = new BufferedInputStream(new FileInputStream("/home/fedd/Videos/homevid.mp4"));
    OutputStream fos2 = new BufferedOutputStream(new FileOutputStream("testfile2.mp4", true));

    try {
        int byt;
        int i = 0;
        long time = System.currentTimeMillis();
        while ((byt = ms2.read()) != -1) {
            fos2.write(byt);
            i++;
            if (i > 100000) {
                i = 0;
                long took = System.currentTimeMillis() - time;
                System.out.println("100000 bytes took " + took + " milliseconds which means " + (100000000 / took) + " bytes per second");
            }
        }
        fos2.close();
        ms2.close();
    } catch (Exception e) {
        throw …
Run Code Online (Sandbox Code Playgroud)

java java-io

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

HyperJaxb3 项目发生了什么?

我知道 Hyperjaxb3 库对我的项目非常有用,在多个站点上阅读了一些描述,并决定将它嵌入到我的 Spring-Hibernate 项目中。

我在https://jaxb.java.net/ 中找到了对 Hyperjaxb3 的引用,看起来很官方,但是超链接 - http://confluence.highsource.org/display/HJ3/Home - 没有打开。

我找到了一些旧的 POM 示例,将其包含在我的项目中,并找到了一些旧版本的引用,试图消除它们,但现在似乎我遇到了对旧 Hibernate 版本的依赖,错误就像这个:

java.util.ServiceConfigurationError: com.sun.tools.xjc.Plugin: Provider org.jvnet.hyperjaxb3.hibernate.plugin.HibernatePlugin 无法实例化: java.lang.NoClassDefFoundError: org/hibernate/type/MutableType

我想知道是否有更好的 Maven 条目,项目是否还活着以及如何将它与现代 Hibernate 一起使用。

这是我关于 Hyperjaxb3 的 pom 摘录,其中我排除了一些过时的链接并指定了其他依赖项的最新版本:

    <dependency>
        <groupId>org.glassfish.jaxb</groupId>
        <artifactId>jaxb-core</artifactId>
        <version>${jaxb-version}</version>
    </dependency>        
    <dependency>
        <groupId>org.glassfish.jaxb</groupId>
        <artifactId>jaxb-xjc</artifactId>
        <version>${jaxb-version}</version>
    </dependency>  
    <!--<dependency>
        <groupId>org.jvnet.hyperjaxb3</groupId>
        <artifactId>hyperjaxb3</artifactId>
        <version>0.6.1</version>
    </dependency>        -->
    <dependency>
        <groupId>org.jvnet.hyperjaxb3</groupId>
        <artifactId>hyperjaxb3-hibernate-plugin</artifactId>
        <version>0.1</version>
        <exclusions>
            <exclusion>
                <groupId>hsqldb</groupId>
                <artifactId>hsqldb</artifactId>
            </exclusion>
            <exclusion>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
            </exclusion>
            <exclusion>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
            <exclusion>
                <groupId>net.sf.saxon</groupId>
                <artifactId>saxon</artifactId>
            </exclusion>
            <exclusion>
                <groupId>net.sf.saxon</groupId>
                <artifactId>saxon-dom</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.hibernate</groupId> …
Run Code Online (Sandbox Code Playgroud)

jaxb hyperjaxb

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

标签 统计

java ×3

el ×1

elasticsearch ×1

hyperjaxb ×1

java-io ×1

jaxb ×1

jsp ×1

node-postgres ×1

node.js ×1