• Elasticsearch 插入地理索引文档一直为空


    今天在获取插入索引数据的时候,一直提示插入不成功,尝试了很多方法,原来是因为在插入的时候应该先 插入Latitude后插入longitude修改后的代码如下

      public boolean insertIndexDoc(String indexname, String type,
                List<Require> list) throws ApplicationException, Exception {
            // TODO Auto-generated method stub
            String location=null;
            JestClient jestHttpClient = Connection.getClient();
            Bulk.Builder bulk = new Bulk.Builder().defaultIndex(indexname)
                    .defaultType(type);
            for(Require req:list){
                String json = "{"+""location":"+"""+req.getLatitude()+","+req.getLongitude()+"""+","
                +""id":"+"""+req.getId()+"""+","+""user_id":"+"""+req.getUser_id()+"""+","
                +""need_code":"+"""+req.getNeed_code()+"""+","+""craete_date":"+"""+req.getCreate_date()+"""+","
                +""text":"+"""+req.getText()+"""+","+"}";
    //           System.out.println(json);
               Index index = new Index.Builder(json).build();
                bulk.addAction(index);
            }        
            BulkResult  br = jestHttpClient.execute(bulk.build());
    //        jestHttpClient.shutdownClient();
            return br.isSucceeded();
        }

  • 相关阅读:
    SQLServer之删除索引
    SQLServer之修改索引
    SQLServer之创建辅助XML索引
    SQLServer之创建主XML索引
    SQLServer之创建全文索引
    SQLServer之创建唯一非聚集索引
    SQLServer之创建唯一聚集索引
    SQLServer之创建非聚集索引
    SQLServer之添加聚集索引
    给NSMutableArray添加copy属性就变成了NSArray
  • 原文地址:https://www.cnblogs.com/youran-he/p/7435649.html
Copyright © 2020-2023  润新知