otto-de / flummi Goto Github PK
View Code? Open in Web Editor NEWFlummi Elastic Search HTTP REST Client
Home Page: https://github.com/otto-de/flummi
License: Apache License 2.0
Flummi Elastic Search HTTP REST Client
Home Page: https://github.com/otto-de/flummi
License: Apache License 2.0
Hey everyone,
I implemented query-time boosting for term queries. Micha can you please release?
AsyncHttpClient asyncHttpClient = new AsyncHttpClient();
Flummi flummi = new Flummi(asyncHttpClient, "http://elasticsearch.base.url:9200");
SearchRequestBuilder searchRequestBuilder = flummi
.prepareSearch("krz")
.setTypes("pod14")
.setQuery(
QueryBuilders.matchAll().build()
);
SearchResponse response = searchRequestBuilder.execute();
response.getHits().stream().toString();
If we say that i run this http://elasticsearch.base.url:9200/krz/pod14/_search i get json response in the browser, but how do i pass this using flummi. What am i doing wrong?
How can i run this url with the Flummi library?
and i get this error
07-12 18:17:56.903 21674-21674/com.quanterall.watchtok E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.quanterall.watchtok, PID: 21674
java.lang.NoSuchMethodError: No static method join(Ljava/lang/CharSequence;[Ljava/lang/CharSequence;)Ljava/lang/String; in class Ljava/lang/String; or its super classes (declaration of 'java.lang.String' appears in /system/framework/core-oj.jar)
at de.otto.flummi.RequestBuilderUtil.buildUrl(Unknown Source)
at de.otto.flummi.request.SearchRequestBuilder.execute(Unknown Source)
at com.quanterall.watchtok.ElasticSearch.(ElasticSearch.java:33)
at com.quanterall.watchtok.MainActivity.onCreate(MainActivity.java:164)
at android.app.Activity.performCreate(Activity.java:6910)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2746)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2864)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1567)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6531)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)
PS. I replace my host and port that i use with this -> elasticsearch.base.url:9200
Since the query DSL is quite complex, I'd suggest to allow the use of ElasticSearch built-in query builders (https://www.elastic.co/guide/en/elasticsearch/client/java-api/current/java-query-dsl.html), which are richer than the ones provided by Flummi.
In my project I use these query builders and then convert them to JsonObject
, this should also be possible without explicit conversion (let Flummi handle it)
Is there a way to get the mapping for specific index through this library yet?
Thanks!
-patrick
The REST API allows partial updates to documents:
https://www.elastic.co/guide/en/elasticsearch/guide/current/partial-updates.html
It is, however, not supported in Flummi (as far as I could see). This would be very helpful.
Thanks!
java.lang.NullPointerException at de.otto.flummi.request.SearchRequestBuilder.parseResponse(SearchRequestBuilder.java:212) at de.otto.flummi.request.SearchRequestBuilder.execute(SearchRequestBuilder.java:180)
SearchRequestBuilder
JsonObject jsonResponse = gson.fromJson(response.getResponseBody(), JsonObject.class);
returns "{}"
response.getResponseBody()
returns
{"took":3,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":2,"max_score":1.0,"hits":[{"_index":"salesorders","_type":"salesorders","_id":"AVoUU6q__Si-JRVFBPXC","_score":1.0,"_source":{"quoteNumber":"11111111111","quoteReference":"blablabla","postCode":"RH41EA"}},{"_index":"salesorders","_type":"salesorders","_id":"AVoUU764_Si-JRVFBPXD","_score":1.0,"_source":{"quoteNumber":"11111111111","quoteReference":"blablabla","postCode":"RH41EA"}}]}}
I implemented support for boosting queries.
Can you please release?
Hi
I caught exception when I was trying to send request to elasticsearch:
de.otto.flummi.InvalidElasticsearchResponseException: Invalid reply from Elastic Search: {"acknowledged":true} at de.otto.flummi.request.CreateIndexRequestBuilder.execute(CreateIndexRequestBuilder.java:59)
JsonObject responseObject = gson.fromJson(jsonString, JsonObject.class);
This line could not deserialize string "{"acknowledged":true}"
But this can
JsonElement element = gson.fromJson (jsonString, JsonElement.class); JsonObject responseObject = gson.element.getAsJsonObject();
Could you make a fix and upload jar file to manen?
Thanks!
RT, i want to use flummi for SQL operation (sum(c) group by a, b) , if it supports this? i hava tried, but it's not well supported.
Hi,
It seems Flummi is currently using the Ning AsyncHttpClient library for async http requests. The Ning library however depends on a pretty old version of Netty (3.1.6 Final), where the latest version is (4.x.x). Unfortunately the Ning library does not seem to receive any updates, and unfortunately we have a dependency in our project on Netty 4.x.x. Would you support changing the Ning library to the new async-http-client here: https://github.com/AsyncHttpClient/async-http-client
Thanks!
-patrick
It seems that Flummi is missing the Bool match query as documented here:
https://www.elastic.co/guide/en/elasticsearch/guide/current/_how_match_uses_bool.html -and-
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html
Any plans of introducing this?
Thanks!
-patrick
java.lang.NullPointerException: null at de.otto.flummi.request.BulkRequestBuilder.execute(BulkRequestBuilder.java:67) ~[flummi-5.0.25.1.jar:?]
response
{"took":167,"errors":false,"items":[{"index":{"_index":"salesorderindexes","_type":"salesorderindexes","_id":"AVo888uqYQNupmNJrA6f","_version":1,"result":"created","_shards":{"index":{"_index":"virtual1salesorderindexes","_type":"virtual1salesorderindexes","_id":"AVo888uqYQNupmNJrA8B","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"created":true,"status":201}},{"index":{"_index":"virtual1salesorderindexes","_type":"virtual1salesorderindexes","_id":"AVo888uqYQNupmNJrA8C","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"created":true,"status":201}}]}
flummi-5.0.25.1.jar, elastic 5.2
Please check #8 again
Hi,
Is there currently a way to create a mapping according to specific class?
I think it can be very useful especially with support of optional annotations that declare the type of analiyzer should be used for a field.
I was thinking to contribute, what do you think?
I implemented support for the missing features in the bool query. Micha, can you please release it?
Elasticsearch 5.0.0 introduced the low-level Java REST client which is based on Apache HttpComponents and, among other things supports "sniffing" the Elasticsearch cluster topology.
It would be great if Flummi could build upon this officially supported way to connect to Elasticsearch.
If you're interested in this, I could probably provide a pull request implementing this (breaking) change.
Hi,
When we upgraded flummi 7 to 8, we saw that the class files uploaded to maven are compiled with JDK17 as the target (major version: 57). Since our Jenkins CI is still running on JDK11, we can't upgrade to the version 8 of flummi (we can't even take the route to include the project as a source project, since it depends on the maven plugin, which is not available anymore in gradle 7.*).
I think there is a configuration for Idea to set the JDK version to 1.8. But I don't think those values are used when building and uploading to maven.
Could we maybe properly configure the version and also upload a new version to maven?
For example, if you still want to target JDK8:
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.