Difference between com.google.datastore.v1 and com.google.cloud.datastore / Missing parameters to disable the index

I am currently creating a Google Cloud Dataflow task that parses XML files and saves records using Google Datastore, as various Java libraries look very confusing.

At first I found com.google.datastore.v1 that works fine with Dataflow, but later I realized that there is no option to exclude fields from indexing. (Most of my fields do not need an index and will never be used in a query.)

Then I found com.google.cloud.datastore, which has a method called "setExcludeFromIndexes" to achieve exactly what I was looking for, but Dataflow cannot save entities generated using this library.

Is one of the libraries newer or what's the difference at all? And is there a way to disable indexes for individual fields using the v1 library?

+4
source share
2 answers

v1-library is a thin layer that provides generated proton sources and some helper functions.
google-cloud-datastore is a shell using the v1 library designed for more convenient use.
To allow various Datastore client libraries to interact with Dataflow, we use the v1 library as it is the least common denominator.

google-cloud-datastore, v1-library google-cloud-datastore (protobuf 3.0.0 v 3.0.0-beta-1 ) , v1-library.

v1- , , , -. exclude_from_indexes .

+4

( ), com.google.datastore.v1:

Value value = Value.newBuilder()
    .setStringValue("foo")
    .setExcludeFromIndexes(true)
    .build();
+3

Source: https://habr.com/ru/post/1665780/


All Articles