[elasticsearch,elasticsearch5] Add Elasticsearch 5.x binding#925
Conversation
|
@jasontedor I know that ES is moving towards the Java REST client but this was the closest to what the existing Elasticsearch binding was doing. If its not the right approach no worries. |
|
Thanks a lot for doing thing @risdenk. Yeah, I was going to use the low-level REST client when I made time to address #893. Also, my plan was to support scan by indexing another field, and it'd probably be better to let auto-IDs be employed here. Do you want to make those changes or would you like me to? (To be clear, I'm happy either way.) |
|
Your ideas sounds good to me. I might take a crack at it tonight. If I don't get to it feel free to work on it. |
|
@jasontedor This is still a work in progress but pushed my changes just in case its helpful. I started working on the REST client here: ElasticsearchRestClient.java Its not integrated yet with the tests or as far as the binding goes. Just a start to see how it would lay out. I'm hoping we can opt for either Transport or REST client to allow benchmarking both. |
|
Hi @risdenk , I checked out your branch and trying to build the elasticsearch5 client. After I put a "elasticsearch5" entry in bin/ycsb and started to run it, it threw exception saying IllegalArgumentException. It seems that it also put workload file into setting |
|
Hello, Same problem than @MichaelTong here. Apparently, when choosing The second bug is that the client throws a I just added a pull request to fix this. Hope this helps :). |
|
@risdenk Should we still target this for 0.13? Thanks! |
* master: [core] Fixing squid:S1319 - Declarations should use Java collection interfaces such as "List" rather than specific implementation classes such as "LinkedList". (manolama - updated bindings added since the PR) [core] Use longs instead of ints to support larger key spaces. Changed int to long in Measurements code to support large scale workloads. (manolama - fixed checkstyle errors) [core] Export totalHistogram for HdrHistogram measurement [core] Add an operation enum to the Workload class. This can eventually be used to replace the strings. [core] Add a Fisher-Yates array shuffle to the Utils class. [core] Fix an issue where the threadid and threadCount were not passed to the workload client threads. Had to use setters to get around the checkstyle complaint of having too many parameters. Upgrading googlebigtable to the latest version. The API used by googlebigtable has had quite a bit of churn. This is the minimal set of changes required for the upgrade. [geode] Update to apache-geode 1.2.0 release [core] Update to use newer version of Google Cloud Spanner client and associated required change [core] Add a reset() method to the ByteIterator abstract and implementations for each of the children. This lets us re-use byte iterators if we need to access the values again (when applicable). [hbase12] Add HBase 1.2+ specific client that relies on the shaded client artifact provided by those versions. (brianfrankcooper#970) [distro] Refresh Apache licence text (brianfrankcooper#969) [memcached] support binary protocol (brianfrankcooper#965) [accumulo] A general "refresh" to the Accumulo binding (brianfrankcooper#947) [cloudspanner] Add binding for Google's Cloud Spanner. (brianfrankcooper#939) [aerospike] Change the write policy to REPLACE_ONLY (brianfrankcooper#937)
This commit bumps the Elasticsearch dependency version of the Elasticsearch 5 binding to version 5.5.1.
If path.home is not set we should not add it to the settings object used to construct the transport client otherwise we will hit a null pointer exception due to the null value being dereferenced in the internals of Elasticsearch.
Since Elasticsearch 5, Elasticsearch is now strict about settings. This means that if you pass it a setting that it does not recognize, Elasticsearch will throw an exception whereas previously it was lenient in such situations. This commit removes passing all properties as settings to Elasticsearch in favor of a special prefix es.setting for which properties prefixed with this will be passed as settings to Elasticsearch.
Upstream Elasticsearch does not support embedded nodes as of Elasticsearch 5. This commit removes the usage of embedded nodes within YCSB.
This commit refactors the indexing of documents in the Elasticsearch 5 binding to use auto-generated IDs, instead indexing the key field as a dedicated field rather than using it as the ID. This enables us to implement scan functionality which we add in this commit as well.
We can remove the path.home setting for the Elasticsearch 5 binding for the transport client so this commit does that.
This commit fixes a bug in the Elasticsearch 5 transport client binding. Namely, the update method was not indexing using the ID of the read document, but instead the provided key. As auto-generated IDs are used, this is a mistake as this is not the ID of the document. This commit fixes this issue. Additionally, the type is passed to the search method and used in searches. While this is not a correctness issue per se, we fix it for clarity.
This commit is an initial cut at a complete implementation using the low-level Elasticsearch REST client.
This commit is a straightforward code cleanup of the Elasticsearch 5 transport client and REST client implementations.
This commit fixes issues with the Elasticsearch 5 transport client and REST client bindings so that all tests pass.
This commit updates the Elasticsearch 5 binding docs to include references for starting Elasticsearch 5, how to configure the transport client, and how to use the low-level REST client binding.
|
@risdenk I think that this a ready now as tests are passing now for both the transport client and REST client bindings. I'm not sure who should review this, can you? |
This commit sets the Elasticsearch 5 binding to only use the elasticsearch-maven-plugin if tests are running on JDK 8.
|
@jasontedor The current implementation for the ES5 binding does not support scan operations. In ES5, RangeQueries are not allowed on the field |
|
@levaphenyl I updated this pull request to add support for scan by indexing another field that we can do range queries on. I made almost no effort to optimize this, only to get something working first that can be iterated on later after integration (first make it right, then make it fast). 😄 |
|
@jasontedor Sorry, I didn't read your commits well enough. This looks nice and adding the support for auto-ID is a great idea! Thank you 😄. |
|
@levaphenyl You're welcome, thanks for your interest! |
This commit adds some basic formatting to the transport client logs for the transport client used in the Elasticsearch 5 binding.
|
@jasontedor - I'll take a look |
risdenk
left a comment
There was a problem hiding this comment.
@jasontedor Changes look good. I didn't get a chance to run it yet probably tomorrow.
Most of the comments are around stderr vs stdout. Stdout is typically reserved for metric output only and everything else to stderr. The other thought is using log4j instead of System...println/err.printStackTrace() for some of the messages.
| } | ||
| } | ||
| final String clusterName = settings.get("cluster.name"); | ||
| System.out.println("Elasticsearch cluster name = " + clusterName); |
There was a problem hiding this comment.
Think this should go to System.err if we need it. Metrics should go to standard out.
| .put("client.transport.nodes_sampler_interval", "30s"); | ||
| // Default it to localhost:9300 | ||
| final String[] nodeList = props.getProperty("es.hosts.list", DEFAULT_REMOTE_HOST).split(","); | ||
| System.out.println("Elasticsearch Remote Hosts = " + props.getProperty("es.hosts.list", DEFAULT_REMOTE_HOST)); |
There was a problem hiding this comment.
Think this should go to System.err if we need it. Metrics should go to standard out.
| es.index.key=es.ycsb | ||
| es.number_of_shards=1 | ||
| es.number_of_replicas=0 | ||
| es.newdb=false |
There was a problem hiding this comment.
Does newdb make sense here? New index?
|
|
||
| return Status.OK; | ||
| } catch (final Exception e) { | ||
| e.printStackTrace(); |
There was a problem hiding this comment.
I think this should go to stderr. Not sure it does by default.
There was a problem hiding this comment.
It does, Exception#printStackTrace goes to stderr by default.
|
|
||
| return Status.OK; | ||
| } catch (final Exception e) { | ||
| e.printStackTrace(); |
There was a problem hiding this comment.
should go to stderr
There was a problem hiding this comment.
Exception#printStackTrace goes to stderr by default.
| } | ||
| return Status.OK; | ||
| } catch (final Exception e) { | ||
| e.printStackTrace(); |
There was a problem hiding this comment.
Exception#printStackTrace goes to stderr by default.
| @@ -0,0 +1,7 @@ | |||
| appender.console.type = Console | |||
There was a problem hiding this comment.
Not sure what is getting logged by this but if it is during the YCSB testing should go to stderr instead of stdout.
There was a problem hiding this comment.
It's for any internal logging produced by the transport client (for example, if there are issues connecting to the Elasticsearch cluster, a user can set es.setting.logger.org.elasticsearch to debug and see the debugging logging by the transport client to help debug such an issue. I pushed a65dcb7 so that these logs go to stderr.
| <groupId>org.apache.thrift</groupId> | ||
| <artifactId>libthrift</artifactId> | ||
| <version>${thrift.version}</version> | ||
| <version>0.8.0</version> |
There was a problem hiding this comment.
Why change variable here?
There was a problem hiding this comment.
Hmm...not sure where that came from, was not intentional and will revert.
| <groupId>org.apache.openjpa</groupId> | ||
| <artifactId>openjpa-jdbc</artifactId> | ||
| <version>${openjpa.jdbc.version}</version> | ||
| <version>2.1.1</version> |
There was a problem hiding this comment.
Why change variable here?
There was a problem hiding this comment.
Hmm...not sure where that came from, was not intentional and will revert.
| <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
| <thrift.version>0.8.0</thrift.version> | ||
| <hypertable.version>0.9.5.6</hypertable.version> | ||
| <elasticsearch-version>2.4.4</elasticsearch-version> |
There was a problem hiding this comment.
elasticsearch-version not used anywhere?
This commit reverts some unrelated changes to POMs for other bindings, perhaps made inadvertently while merging master into a development branch.
This commit sets the log of the internal transport client used in the Elasitcsearch 5 binding to use standard error instead of standard out.
This commit removes some unnecessary logging statements for the elasticsearch5 and elasticsearch5-rest bindings.
This commit changes the name of a property, es.newdb, to es.new_index as this is more consistent with the terminology used in Elasticsearch.
This commit wraps the usage of a content builder in a try-with-resources block to ensure that it is correctly closed.
This commit removes an unrelated POM change for the original (Elasticsearch 2) binding.
The comments were incorrectly referring to ElasticsearchClient but they should be referring to ElasticsearchRestClient instead.
|
Thanks @risdenk, I've responded to your feedback. |
|
@jasontedor I see your referenced commits but they aren't on this PR like the other commits? Where did they end up? Its weird that I can't seem to find them but the links you posted work. |
|
I'm not sure, I agree they are not visible on the PR. I also noticed that I did not receive email notifications for the pushes. |
|
@risdenk I think they are visible now. |
risdenk
left a comment
There was a problem hiding this comment.
Changes look good. Tests run as well. Few minor comments from opening in an IDE.
ElasticsearchClientITandElasticsearchRestClientITare basically identical- Could be useful to make one test?
ElasticsearchClientandElasticsearchRestClienthave duplicated methods- Might be worth it to consolidate?
- Since
org.apache.httpis already included could use HttpStatus.SC_CREATED for 201 and others (404, 200, etc).
No other major things from me so could be merged.
| return performRequest(restClient, method, endpoint, params, null); | ||
| } | ||
|
|
||
| private static Header[] emptyHeaders = new Header[0]; |
There was a problem hiding this comment.
nit: could be final?
This commit removes duplicate test code from the elasticsearch5 and elasticsearch5-rest test classes.
This commit marks a field intended to be treated as a constant as final.
This commit replaces some magic numbers (HTTP status codes) with already-existing constants for this purpose.
This commit removes an extraneous newline from ElasticsearchRestClient.java.
|
Thanks @risdenk! Regarding your last few suggestions I addressed them all except for consolidating code between ElasticsearchClient and ElasticsearchRestClient, I prefer keeping the refresh logic separate. |
|
Just tested the implementation on my cluster and I get a |
Fixes #893
Elasticsearch 5.x Highlights:
_idor_uid)Other changes: