Data Client IndexApi

The IndexApi mirrors the Index Rest Api.

It can be used to get the data handles of the partitions that match a query. Then, use the data handles with the blob service to get the data from the partitions. Also, an index layer is an index of the catalog’s data. One use of an index layer is to archive data from a stream layer so you can query it.

For the full IndexApi specification, see IndexApi.

The following pages descibe the per-request configuration and metrics.

Example

Scala
Java
val client = BaseClient()
val indexApi = client.of[IndexApi]

val someHrn = "hrn:here:data::olp-here-test:whatever"
val someLayer = "whateverIndexLayer"
val someQuery = "tileId=INBOUNDINGBOX=(23.648524, 22.689013, 62.284241, 60.218811)"
val result: Future[DataResponse] =
  indexApi.performQuery(someHrn, someLayer, someQuery).executeToEntity()

result
  .andThen {
    case Success(response) =>
      // do something with the index data response
      response.data.foreach { partitionMetadata =>
        partitionMetadata.foreach { kvmap =>
          kvmap.foreach { kv =>
            println(s"${kv._1} = ${kv._2}")
          }
        }
      }
    case Failure(ex) =>
      ex.printStackTrace()
  }
  .andThen {
    case _ =>
      client.shutdown()
  }

Await.result(result, Duration.Inf)
BaseClient client = BaseClientJava.instance();
IndexApi indexApi = new IndexApi(client);

String someHrn = "hrn:here:data::olp-here-test:whatever";
String someLayer = "whateverIndexLayer";
String someQuery = "tileId=INBOUNDINGBOX=(23.648524, 22.689013, 62.284241, 60.218811)";

DataResponse result =
    indexApi
        .performQuery()
        .withHrn(someHrn)
        .withLayerID(someLayer)
        .withQuery(someQuery)
        .build()
        .executeToEntity()
        .toCompletableFuture()
        .join();

// do something with the index data response
result
    .getData()
    .get()
    .forEach(
        partitionMetadata ->
            partitionMetadata
                .entrySet()
                .forEach(kv -> System.out.println(kv.getKey() + " = " + kv.getValue())));

client.shutdown().toCompletableFuture().join();

results matching ""

    No results matching ""