Java API related questions


(Paweł Konieczny) #1

Hey!

While developing a wrapper for elasticsearch for my application I got
a little confused with the asynchronous nature of the calls and the
Java API. The API is really neat, but it somewhat suffers from
ambiguity.

I think a few more examples with a full breakdown of each method would
really help a lot in clarifying all doubts.
Meanwhile I have some questions:

  1. What does the execute() method on a request builder actually do?
  2. What does the actionGet() method do?
  3. If a resource is added to the indexer queue (if I understand
    correctly, that's what happens after executing the prepareIndex
    directive) is there anything that can do wrong with indexing later on?
    If so, how to find out?
  4. What are index() and delete() methods for?

Cheers,
Pawel


(Shay Banon) #2

2011/8/19 Paweł Konieczny koniecznypw@gmail.com

Hey!

While developing a wrapper for elasticsearch for my application I got
a little confused with the asynchronous nature of the calls and the
Java API. The API is really neat, but it somewhat suffers from
ambiguity.

I think a few more examples with a full breakdown of each method would
really help a lot in clarifying all doubts.
Meanwhile I have some questions:

  1. What does the execute() method on a request builder actually do?

Returns a Future, which you can use to either block for a response, or add a
listener to.

  1. What does the actionGet() method do?

Blocks till the operation is executed and a response is returned.

  1. If a resource is added to the indexer queue (if I understand
    correctly, that's what happens after executing the prepareIndex
    directive) is there anything that can do wrong with indexing later on?
    If so, how to find out?

Calling prepareIndex (for example) does not do anything, calling execute
causes that call to be executed, and you can use the returned Future to
decide how to act on it. Calling actionGet makes it fully blocking call.

  1. What are index() and delete() methods for?

Similar APIs to prepareIndex, just a different flavor. The one that returns
a response is a blocking call, the one that accepts a listener is not.

Cheers,
Pawel


(Paweł Konieczny) #3

Hey!

Thanks for clarifying those issues, it all makes sense now. I think
that some kind of Java API quick start tutorial would really help
developers who stumble upon this great project and thus increase the
number of production stories.
The existing guide forces the user to dig deep, which isn't always the
best way to learn something new.

Cheers,
Pawel

On Aug 22, 8:46 pm, Shay Banon kim...@gmail.com wrote:

2011/8/19 Paweł Konieczny konieczn...@gmail.com

Hey!

While developing a wrapper for elasticsearch for my application I got
a little confused with the asynchronous nature of the calls and the
Java API. The API is really neat, but it somewhat suffers from
ambiguity.

I think a few more examples with a full breakdown of each method would
really help a lot in clarifying all doubts.
Meanwhile I have some questions:

  1. What does the execute() method on a request builder actually do?

Returns a Future, which you can use to either block for a response, or add a
listener to.

  1. What does the actionGet() method do?

Blocks till the operation is executed and a response is returned.

  1. If a resource is added to the indexer queue (if I understand
    correctly, that's what happens after executing the prepareIndex
    directive) is there anything that can do wrong with indexing later on?
    If so, how to find out?

Calling prepareIndex (for example) does not do anything, calling execute
causes that call to be executed, and you can use the returned Future to
decide how to act on it. Calling actionGet makes it fully blocking call.

  1. What are index() and delete() methods for?

Similar APIs to prepareIndex, just a different flavor. The one that returns
a response is a blocking call, the one that accepts a listener is not.

Cheers,
Pawel


(Andrej) #4

A few more examples or explanations would make life easier, for sure. I became a real fan of this project, but digging deeper not everything is selfexplaning (at least in my eyes) and looking at examples is helpfull anyway. Shay, have you ever considered setting up a Wiki so users could help you with documentation? I'm sure a lot of people would benefit from it. And maybe you could transfer parts back to your guide or javadoc?


(Shay Banon) #5

The site is hosted on github, you can easily contribute to it:
http://www.elasticsearch.org/community/contributing-site.html.

On Wed, Aug 24, 2011 at 11:28 AM, Andrej andrej.rosenheinrich@unister.dewrote:

A few more examples or explanations would make life easier, for sure. I
became a real fan of this project, but digging deeper not everything is
selfexplaning (at least in my eyes) and looking at examples is helpfull
anyway. Shay, have you ever considered setting up a Wiki so users could
help
you with documentation? I'm sure a lot of people would benefit from it. And
maybe you could transfer parts back to your guide or javadoc?

--
View this message in context:
http://elasticsearch-users.115913.n3.nabble.com/Java-API-related-questions-tp3268417p3280372.html
Sent from the ElasticSearch Users mailing list archive at Nabble.com.


(system) #6