The API package 'search' or call 'IndexDocument()' was not found

193 views
Skip to first unread message

Apurva Nandan

unread,
Jul 26, 2016, 4:53:53 PM7/26/16
to Google App Engine

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?

Nicholas (Google Cloud Support)

unread,
Jul 27, 2016, 9:46:49 AM7/27/16
to Google App Engine
This error suggests that the package and API call you are attempting to use are not present.  This may very well be due to the version of the SDK you are using.  1.9.18 was released on February 19, 2015.  There have been numerous releases, patches and fixes since.  We're currently at 1.9.40.  I would strongly suggest updating to this most recent version and re-attempting this, providing this error again if it arises.

Apurva Nandan

unread,
Jul 27, 2016, 1:53:29 PM7/27/16
to google-a...@googlegroups.com

Hello,

I tried the Java SDK 1.9.40 but the problem still persists. Have spent a lot of time on this but not able to figure out the problem. Do you have any more hints ?

-Apurva


--
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 google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
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/d7c4b741-602e-4e8a-958f-18e0df425393%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Nick (Cloud Platform Support)

unread,
Jul 29, 2016, 4:53:19 PM7/29/16
to Google App Engine
Hey Apurva,

Could you show the details of how you installed SDK 1.9.40? It's possible you're still compiling / deploying with the old SDK, which is expected to throw this error.

Cheers!

Nick
Cloud Platform Community Support


On Wednesday, July 27, 2016 at 1:53:29 PM UTC-4, Apurva Nandan wrote:

Hello,

I tried the Java SDK 1.9.40 but the problem still persists. Have spent a lot of time on this but not able to figure out the problem. Do you have any more hints ?

-Apurva

To unsubscribe from this group and all its topics, send an email to google-appengine+unsubscribe@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.

Apurva Nandan

unread,
Aug 5, 2016, 2:25:44 PM8/5/16
to google-a...@googlegroups.com

Hi. I am using Eclipse and in the configuration for Google app engine, I just provide the latest SDK location (folder) which I have downloaded.
I have cross-checked it multiple times. I am using the latest SDK.

- Apurva


Apurva Nandan

unread,
Aug 5, 2016, 3:41:01 PM8/5/16
to google-a...@googlegroups.com

Is there any problem with the Java SDK, I tried the latest version 1.9.42 in eclipse. It still doesn't work. This is really puzzling me now.


On Aug 5, 2016 9:25 PM, "Apurva Nandan" <apurv...@gmail.com> wrote:

Hi. I am using Eclipse and in the configuration for Google app engine, I just provide the latest SDK location (folder) which I have downloaded.
I have cross-checked it multiple times. I am using the latest SDK.

- Apurva

Nick (Cloud Platform Support)

unread,
Aug 5, 2016, 4:07:49 PM8/5/16
to Google App Engine
Hey Apurva,

Could you email me the full code so that I can test on a completely separate system from your own? My address in case you can't see it is pay...@google.com. Ordinarily we would want this kind of issue reported in the Public Issue Tracker, but I'll be happy to look into this from here.

Cheers,


Nick
Cloud Platform Community Support

Nick (Cloud Platform Support)

unread,
Aug 8, 2016, 3:47:32 PM8/8/16
to Google App Engine
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 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:

Apurva Nandan

unread,
Aug 14, 2016, 8:39:57 AM8/14/16
to google-a...@googlegroups.com
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

--
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 google-appengine+unsubscribe@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.

Apurva Nandan

unread,
Aug 15, 2016, 1:18:15 PM8/15/16
to google-a...@googlegroups.com

I found it under WEB-INF folder.
Thanks again for resolving the issue !


On Aug 14, 2016 3:39 PM, "Apurva Nandan" <apurv...@gmail.com> wrote:
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

Nick (Cloud Platform Support)

unread,
Aug 15, 2016, 4:50:31 PM8/15/16
to Google App Engine
Hey Apurva,

Glad to hear we could get it working. Best of luck going forward!


Cheers,

Nick
Cloud Platform Community Support

Reply all
Reply to author
Forward
0 new messages