class ESWorkplace
  def self.index(documents)
    host = 'https://compute-optimized-deployment-0dc7cc.ent.asia-northeast1.gcp.cloud.es.io'
    access_token = ENV['ESW_ACCESS_TOKEN']
    content_source_id = '60f8f19609302094d6db7531'

    workplace_search_client = Elastic::EnterpriseSearch::WorkplaceSearch::Client.new(
      host: host,
      http_auth: access_token
    )
    response = workplace_search_client.index_documents(content_source_id, {documents: documents})
  end
end