Hi Nick,

Many thanks a lot for resolving the issue which was literally puzzling me.
I was actually following my old elasticsearch way of indexing the documents
by creating desktop based jars to run periodically as cron jobs. But I
guess, I will figure something out in this case as well.

Just a small question, when I run this thing on the development server,
where is the index stored locally?

- Apurva

On Mon, Aug 8, 2016 at 10:47 PM, 'Nick (Cloud Platform Support)' via Google
App Engine <[email protected]> wrote:

> Hey Apurva,
>
> The reason this is failing is because you should be running this code in
> the context of an App Engine servlet, not merely within the main() method
> of a traditional java class. Here is an example tutorial
> <https://cloud.google.com/appengine/docs/java/gettingstarted/creating-guestbook>showing
> a basic java app for App Engine. When I ran the code within the App Engine
> development server environment and in production, I saw no errors.
>
> Cheers,
>
> Nick
> Cloud Platform Community Support
>
> On Tuesday, July 26, 2016 at 4:53:53 PM UTC-4, Apurva Nandan wrote:
>
>>
>> Using Google App Engine's Search API, I am trying to index some document
>> into a test index. I am using the code sample given on the Google App
>> Engine official documentation. But when I try to run the snippet below. I
>> get the following error when I tr to put a document via index.put:
>>
>> Exception in thread "main" 
>> com.google.apphosting.api.ApiProxy$CallNotFoundException:
>> The API package 'search' or call 'IndexDocument()' was not found. at
>> com.google.apphosting.api.ApiProxy$1.get(ApiProxy.java:179) at
>> com.google.apphosting.api.ApiProxy$1.get(ApiProxy.java:177) at
>> com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:88)
>> at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:88)
>> at 
>> com.google.appengine.api.search.FutureHelper.getInternal(FutureHelper.java:73)
>> at 
>> com.google.appengine.api.search.FutureHelper.quietGet(FutureHelper.java:32)
>> at com.google.appengine.api.search.IndexImpl.put(IndexImpl.java:486) at
>> test.service.SearchingService.indexADocument(SearchingService.java:52)
>>
>> Here's the code snippet:
>>
>>  IndexSpec indexSpec = IndexSpec.newBuilder().setName(indexName).build();
>>
>>           SearchService service = SearchServiceFactory.getSearchService(
>>                    
>> SearchServiceConfig.newBuilder().setDeadline(10.0).setNamespace("geeky").build());
>>           Index index = service.getIndex(indexSpec);
>>
>>
>>
>>           final int maxRetry = 3;
>>           int attempts = 0;
>>           int delay = 2;
>>           while (true) {
>>             try {
>>
>>               index.put(document); // ERROR!!!!!!!!!!
>>             } 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;
>>           }
>>
>>         }
>>
>> I am using appengine-java-sdk-1.9.18 with Eclipse Kepler. It doesn't
>> matter if I run the code on a local dev server or in production hosted on
>> appspot. I get the same error. I am already authenticated in eclipse to my
>> google account, and am able to push my code into production via eclipse.
>> Has anybody seen this error before?
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Google App Engine" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/google-appengine/w9Pv1JH9nHg/unsubscribe.
> To unsubscribe from this group and all its topics, 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/5b908f62-e248-4694-9900-
> 05a4bf31cfd3%40googlegroups.com
> <https://groups.google.com/d/msgid/google-appengine/5b908f62-e248-4694-9900-05a4bf31cfd3%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAFk2cV6NPRkv5gtJZ7Usa-KZE_g%2BkuKDzC%2BZH2a_1XWjeKYBhQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
  • [google-appengine]... Apurva Nandan
    • [google-appen... 'Nicholas (Google Cloud Support)' via Google App Engine
      • Re: [goog... Apurva Nandan
        • Re: [... 'Nick (Cloud Platform Support)' via Google App Engine
          • R... Apurva Nandan
            • ... Apurva Nandan
              • ... 'Nick (Cloud Platform Support)' via Google App Engine
    • [google-appen... 'Nick (Cloud Platform Support)' via Google App Engine
      • Re: [goog... Apurva Nandan
        • Re: [... Apurva Nandan
          • R... 'Nick (Cloud Platform Support)' via Google App Engine

Reply via email to