Hello,
I'm using the App Engine Search API to perform full text search on my
Firestore database. I'm getting the following error when putting documents
into the Search index:
com.google.appengine.api.search.PutException: Error constructing stub for
app s~hanji-bd63d
I'm using a ServletContextListener that connects to my database and adds
Documents in the index when the instance is being initialized. Here is the
code that puts a Document in the index.
private void indexADocument(String indexName, Document document) throws
InterruptedException {
IndexSpec indexSpec =
IndexSpec.newBuilder().setName(indexName).build();
Index index =
SearchServiceFactory.getSearchService().getIndex(indexSpec);
final int maxRetry = 3;
int attempts = 0;
int delay = 2;
while (true) {
try {
index.put(document);
// Getting id
String id = null;
for(Field f: document.getFields("id")){
id = f.getText();
}
db.markDocAsIndexed(id);
} catch (PutException e) {
if
(StatusCode.TRANSIENT_ERROR.equals(e.getOperationResult().getCode())
&& ++attempts < maxRetry) { // retrying
Thread.sleep(delay * 1000);
delay *= 2; // easy exponential backoff
continue;
} else {
throw e; // otherwise throw
}
}
break;
}
}
This is only a recent problem, I've already added thousands of documents to
my search index using this method and have had no problems, so I'm not sure
what could be causing this.
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-appengine/2e6c5e4b-303a-4871-a6ed-f6212b33c741%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.