Skip to content

Handle errors with force encoding#52

Open
frazerh wants to merge 73 commits into
grantr:masterfrom
frazerh:handle_errors_with_force_encoding
Open

Handle errors with force encoding#52
frazerh wants to merge 73 commits into
grantr:masterfrom
frazerh:handle_errors_with_force_encoding

Conversation

@frazerh
Copy link
Copy Markdown

@frazerh frazerh commented Mar 26, 2013

Some ES errors cause Encoding::CompatibilityError: incompatible character encodings: UTF-8 and ASCII-8BIT

I am able to duplicate this by starting ES with the following setting:

indices.query.query_string.allowLeadingWildcard: false

Then issue the following query:

client.search({query: {query_string: {query: "*.運動會"}}}, {index: 'test'})

erickt and others added 30 commits March 25, 2013 09:21
This patch lets you pass arbitrary multi_get
queries to elasticsearch. Before this patch, there 
was no way to select the fields to return.
This is helpful on Heroku where server urls include the index.

ElasticSearch.new("http://127.0.0.1:9200/index/type" sets default_index
to "index" and default_type to "type". You can still change them with
the default scope accessors and by passing :index and :type options.

Fixes #31
Bundler 1.1 is the business.
README needs some love! It kinda sucks.
New in this version:

* Compatibility with Heroku ELASTICSEARCH_URL
Will need to switch to http and json abstraction libraries first.
If uri fails to parse, just use the connect string as given.
For testing the thrift transport
This increases platform compatibility and future proofs against better
json libraries than yajl (like oj). Rails is using MultiJson so it isn't
likely to go away.

Both versions of the MultiJson api are supported.

fixes #35
Use rubydoc.info instead
The old rack escape doesn't work with utf8 multibyte strings in ruby
1.9. Relying on Faraday's popularity to take care of that.

If Faraday doesn't work out, Rack's new escape is supposed to be pretty
good.

This commit also removes support for ruby 1.8.6. Faraday only
supports 1.8.7+, so the rubberband dependency is bumped too.
Patron relies on a C extension so it is not compatible with JRuby.
Faraday supports multiple backends so it will work on more platforms.

fixes #36
grantr and others added 30 commits March 25, 2013 09:21
Fixes error when calling previously private methods.
Previously this was ignored. Fixes #39
This overrode :size given in the query. Elasticsearch defaults to
size 10 anyway so there's no need for a default here.
MultiJson and Faraday allow running on JRuby, yay!
Elasticsearch 0.19.9 no longer supports the _all syntax, and * seems to
be supported at least as far back as 0.14.2.
The code doesn't work as given without this. Fixes #43
…define basic auth, so don't override them per request.
Checking for index existence is a common operation, and previously it
was pretty cumbersome.

Instead of getting the status of all indices and checking for the
requested key, this implementation checks for the status of the
requested index only and rescues the missing exception. This saves on
bandwidth if you have a lot of indices.
Response status is the most useful indicator of what went wrong.
Elasticsearch allows delete_by_query across multiple indices and types,
so no need to require scope.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants