Skip to content

Added support for routing parameters. #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Apr 7, 2015

Conversation

cdahlqvist
Copy link

I have added support for routing when indexing documents.

@jordansissel
Copy link
Contributor

Code looks good, I think. I haven't tested it.

@cdahlqvist
Copy link
Author

I copied the parameter description from PR #64 to my code as it is better and more descriptive.

@masteinhauser
Copy link

Ah, I didn't realize there was more work which was needed. Though, I definitely missed adding a test! I'll close out #64 in support of this.

@masteinhauser
Copy link

Is there anything else needed for this PR to be reviewed, tested and merged?

It looks like the tests failed due to a CLA issue but it also seems like the QA process is not updated for the new plugins repo organization.

@jordansissel
Copy link
Contributor

@masteinhauser time. We'll tend to this soon. We are focusing on other priorities at this time.

@masteinhauser
Copy link

Ah, understood. I will package and keep my own internally. Thanks!

@@ -73,6 +73,75 @@
end
end

describe "ship lots of events w/ default index_type and fixed routing key", :elasticsearch => true do
# Generate a random index name
index = 10.times.collect { rand(10).to_s }.join("")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go into a let variable (more info at https://relishapp.com/rspec/rspec-core/v/3-2/docs/helper-methods/let-and-let )

@jordansissel
Copy link
Contributor

@talevy can you take over review on this? @purbon is going on vacation (WOO) and I'd like to help move this forward for our friend @cdahlqvist :)

@cdahlqvist
Copy link
Author

@talevy Added test for dynamic routing parameter as discussed.

@talevy
Copy link
Contributor

talevy commented Mar 20, 2015

@cdahlqvist thanks!

I'll try to check it out and test locally soon and get back to you!

@talevy
Copy link
Contributor

talevy commented Mar 24, 2015

@cdahlqvist why did you change all the insist to expect. can we leave that alone for now? Plus, I cannot run tests as is with that

@talevy
Copy link
Contributor

talevy commented Mar 24, 2015

@cdahlqvist I also see that there are a few result['count'] retrievals for verifying number of responses. This field is only found in _count requests and not _search. to verify count of a search response you may want to look at result['hits']['hits'].size.

@@ -56,7 +56,7 @@
response.read_body { |chunk| data << chunk }
result = LogStash::Json.load(data)
count = result["count"]
insist { count } == event_count
expect { count } == event_count
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have traditionally been using insist for such assertions. I think we should keep it with insist for the sake of keeping this PR's main goal to add the _routing functionality

data = ""
response.read_body { |chunk| data << chunk }
result = LogStash::Json.load(data)
count = result["count"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

result["count"] should be result['hits']['hits'].size

@talevy
Copy link
Contributor

talevy commented Mar 24, 2015

I also notice that many of the tests for routing simply check document counts from request with routing parameters. you may simply want to call the count api, and check count, instead of calling search

@cdahlqvist
Copy link
Author

That is a very good point. Will modify to instead use the count API and correct the syntax.

@cdahlqvist
Copy link
Author

@talevy Have cleaned up the routing tests and made them instead use the _count API. Did however not change back to using 'insist' as @purbon preferred the use of 'expect'.

@talevy
Copy link
Contributor

talevy commented Mar 26, 2015

we can go ahead and change insist to expect in a different PR, if you do not mind. Plus, I cannot seem to be able to run the tests with expect

@cdahlqvist
Copy link
Author

@talevy Changed back to using expect. Hopefully it will work properly now.

@cdahlqvist
Copy link
Author

@talevy Have merged changes from master.

@talevy
Copy link
Contributor

talevy commented Mar 30, 2015

@cdahlqvist looks good! but, I am having trouble having the whole test-suite pass... your tests pass. other tests pass. but when I run it all together, things fail. I am trying to debug it. once that is resolved, I will merge this in!

@talevy
Copy link
Contributor

talevy commented Apr 3, 2015

so master is ready. but I cant seem to get your tests to pass. they conflict and cause this:

Apr 03, 2015 1:04:35 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request to {}->http://127.0.0.1:9200: Bad file descriptor

@talevy
Copy link
Contributor

talevy commented Apr 3, 2015

https://github.com/cdahlqvist/logstash-output-elasticsearch/blob/master/spec/outputs/elasticsearch_spec.rb#L701-L704

in the lines above. the mocked actions need to be updated to include the :_routing param.

for example:

let(:action1) { ["index", {:_id=>nil, :_index=>"logstash-2014.11.17", :_type=>"logs"}, event1] }

should be updated to:

let(:action1) { ["index", {:_id=>nil, :_routing=>nil, :_index=>"logstash-2014.11.17", :_type=>"logs"}, event1] }

same goes for :action2

@iemem15
Copy link

iemem15 commented Apr 5, 2015

Hi, When is going to be available to use it?

@cdahlqvist
Copy link
Author

@talevy Have added the routing parameter.

@talevy
Copy link
Contributor

talevy commented Apr 6, 2015

cool! tests are looking good @cdahlqvist!

can you go ahead and update your master from remote and git rebase master so we can merge this in?

@cdahlqvist
Copy link
Author

@talevy Done.

@talevy
Copy link
Contributor

talevy commented Apr 7, 2015

Thank you!

LGTM

talevy added a commit that referenced this pull request Apr 7, 2015
Added support for routing parameters.
@talevy talevy merged commit 63ff11d into logstash-plugins:master Apr 7, 2015
@crickeys
Copy link

Does this currently work for UPDATES in the downloadable or YUM versions of logstash? I'm using logstash-1.4.2-1_2c0f5a1.noarch

I'm having issues with updating parent/child documents. I can't seem to add any routing information when doing an UPDATE action. I keep getting :message=>"Unknown setting 'routing' for elasticsearch", :level=>:error}

I've also tried logstash-1.5.0.rc2-1.noarch and same message. I'm new to logstash/elasticsearch so forgive me if this is obvious.

@talevy
Copy link
Contributor

talevy commented Apr 15, 2015

@crickeys we are still focusing on cleaning up a few pipeline details for another RC3 release in the next week or 2. so it will be in there. For now, this feature is only compatible with development master of Logstash

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.

7 participants