zoukankan      html  css  js  c++  java
  • elastic4s第一课

    1、elastic4s的import的包

    在使用elastic4s 的github的用户使用文档的时候,当使用mevan上下载到lib的jar,但是事实上好像是缺失其他的包或者造成classpath路径问题,实际上在build.sbt上导入包的话,只需要写入6个elastic4s

    相关的包,就会导入其他的除了那6个包外,相关的jar,例如Akka的,Cats的,Jackson的。。。,具体如下:

                      

    能够得知内部包含的部分,如:Cats

                

    2、在elastic4s 常常出现这个的异常

          No implicits found for parameter handler:Handler[]

        这是因为需要

    import com.sksamuel.elastic4s.ElasticDsl._

     3、明确elastic4s的问题

    在oncomplete(excete)==>

          val termfuture:Future[Response[SearchResponse]]=esclient.execute(reterm)
    
            onComplete(termfuture){
              case Success(value) =>
    
    
           println(value)
          //RequestSuccess(200,Some({"took":421,"timed_out":false,"_shards":{"total":1,"successful":1,
    "skipped":0,"failed":0},"hits":{"total":{"value":0,"relation":"eq"},"max_score":null,"hits":[]}}),
    Map(content-type -> application/json; charset=UTF-8, content-length -> 162),
    SearchResponse(421,false,false,null,Shards(1,0,1),None,null,SearchHits(Total(0,eq),0.0,[Lcom.sksamuel.elastic4s.requests.searches.SearchHit;@1b101a9)))
    println(value.result) //SearchResponse(421,false,false,null,Shards(1,0,1),None,null,SearchHits(Total(0,eq),0.0,[Lcom.sksamuel.elastic4s.requests.searches.SearchHit;@1b101a9)) println(value.result.hits) //SearchHits(Total(0,eq),0.0,[Lcom.sksamuel.elastic4s.requests.searches.SearchHit;@1b101a9) // println(value.result.hits.hits)

    4、

    comlete()的里面的数据没有ToResponseMarshallable,故引入包

     "de.heikoseeberger" %% "akka-http-json4s" % "1.28.0"

    来源如下:

          https://www.cnblogs.com/tiger-xc/p/7763466.html

    5、

    org.json4s.package$MappingException: Can't find ScalaSig for interface java.io.Serializable

      通过json4s 编写的的工具类JsonConverter解决

    6、明确查询结果的结构

    查询出来的Response[SeachResponse]

    7、相关logback模块的应用相关appender的设置和导入的相关jar的的具体使用。。

    但是需要考虑的是引用包里面的log也是存在一定的数量的。并且需要考虑如何控制相关的log给info是相关技术层面的。在很多包内存在相关的log.infp()的信息的。。。是包含了(运算过程)生命周期所需要的步骤。。

    能够明确了解整个过程的

     在开发过程中,因为引用了陈老师的jar,即elastic的appender.但是那个jar,仅仅是他代码的编译,没有什么他的引用包,

    即其他的jar,如elastic4s的jar和那个引用包的什么json包和cat包,例如:

    "org.typelevel" %% "cats-core" % "2.0.0-M4"

    ,而此时无法导入相关的Appender :Failed to instantiate type com.datatech.logback.ElasticAppender

    8、是日志的问题

     java.lang.ClassCastException: org.slf4j.impl.SimpleLoggerFactory cannot be cast to ch.qos.logback.c

    不知道这个slf4j的Simple的jar在哪里,直接从lib删除

  • 相关阅读:
    Codeforces 845E Fire in the City 线段树
    Codeforces 542D Superhero's Job dp (看题解)
    Codeforces 797F Mice and Holes dp
    Codeforces 408D Parcels dp (看题解)
    Codeforces 464D World of Darkraft
    Codeforces 215E Periodical Numbers 容斥原理
    Codeforces 285E Positions in Permutations dp + 容斥原理
    Codeforces 875E Delivery Club dp
    Codeforces 888F Connecting Vertices 区间dp (看题解)
    Codeforces 946F Fibonacci String Subsequences dp (看题解)
  • 原文地址:https://www.cnblogs.com/0205gt/p/12758616.html
Copyright © 2011-2022 走看看