[ 
https://issues.apache.org/jira/browse/PIO-49?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15829031#comment-15829031
 ] 

ASF GitHub Bot commented on PIO-49:
-----------------------------------

Github user marevol commented on a diff in the pull request:

    
https://github.com/apache/incubator-predictionio/pull/336#discussion_r96766370
  
    --- Diff: 
data/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESAccessKeys.scala
 ---
    @@ -15,44 +15,45 @@
      * limitations under the License.
      */
     
    -
     package org.apache.predictionio.data.storage.elasticsearch
     
    -import grizzled.slf4j.Logging
    -import org.apache.predictionio.data.storage.StorageClientConfig
    +import java.io.IOException
    +
    +import scala.collection.JavaConverters.mapAsJavaMapConverter
    +
    +import org.apache.http.entity.ContentType
    +import org.apache.http.nio.entity.NStringEntity
    +import org.apache.http.util.EntityUtils
     import org.apache.predictionio.data.storage.AccessKey
     import org.apache.predictionio.data.storage.AccessKeys
    -import org.elasticsearch.ElasticsearchException
    -import org.elasticsearch.client.Client
    -import org.elasticsearch.index.query.FilterBuilders._
    -import org.json4s.JsonDSL._
    +import org.apache.predictionio.data.storage.StorageClientConfig
    +import org.elasticsearch.client.RestClient
     import org.json4s._
    +import org.json4s.JsonDSL._
     import org.json4s.native.JsonMethods._
    -import org.json4s.native.Serialization.read
     import org.json4s.native.Serialization.write
     
    -import scala.util.Random
    +import grizzled.slf4j.Logging
    +import org.elasticsearch.client.ResponseException
     
     /** Elasticsearch implementation of AccessKeys. */
    -class ESAccessKeys(client: Client, config: StorageClientConfig, index: 
String)
    +class ESAccessKeys(client: ESClient, config: StorageClientConfig, index: 
String)
         extends AccessKeys with Logging {
       implicit val formats = DefaultFormats.lossless
       private val estype = "accesskeys"
     
    -  val indices = client.admin.indices
    -  val indexExistResponse = indices.prepareExists(index).get
    -  if (!indexExistResponse.isExists) {
    -    indices.prepareCreate(index).get
    -  }
    -  val typeExistResponse = 
indices.prepareTypesExists(index).setTypes(estype).get
    -  if (!typeExistResponse.isExists) {
    -    val json =
    +  val restClient = client.open()
    --- End diff --
    
    > This is probably a good opportunity to add.
    
    +1
    We could not reuse RestClient because it's not closed.
    I think it's better to call "close" process for storage at the end of 
application, and then reuse RestClient.


> Add support for Elasticsearch 5.x
> ---------------------------------
>
>                 Key: PIO-49
>                 URL: https://issues.apache.org/jira/browse/PIO-49
>             Project: PredictionIO
>          Issue Type: Improvement
>            Reporter: Shinsuke Sugaya
>
> We work on meta/event storage support for Elasticsearch 5.x.
> Although Elasticsearch 2.x does not allow dots in field names,
> Elasticsearch 5.x supports it. So, it's better to upgrade to ES 5.x release.
> Since ES 5.x provides Java Rest API client, we replaced
> Transport communication with HTTP one. Therefore, our fix
> uses HTTP(9200 port) only.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to