# Issue with ".keyword" in ruby filter

**URL:** <https://discuss.elastic.co/t/issue-with-keyword-in-ruby-filter/134743>\
**Category:** Logstash\
**Created:** [June 6, 2018, 7:17am UTC](https://discuss.elastic.co/t/issue-with-keyword-in-ruby-filter/134743 "2018-06-06T07:17:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajkumar\_Selvakumar](https://avatars.discourse-cdn.com/v4/letter/r/a88e4f/32.png) [@Rajkumar\_Selvakumar](https://discuss.elastic.co/u/Rajkumar_Selvakumar)\
**Post date:** [June 6, 2018, 7:17am UTC](https://discuss.elastic.co/t/issue-with-keyword-in-ruby-filter/134743/1 "2018-06-06T07:17:29Z")

</div>

I am using ruby to perform elastic search in logstash config.

The below code works fine , but its returns more than one document because of text based search.

response = client.search index: 'perf\_report\_by\_audit\_and\_jmeter', body: { query: { match: { ' **correlation\_id**': event.get('correlation\_id') } } }  
event.set('existing\_id', response ['hits']['hits'][0]['\_source']['correlation\_id'])

while runing elastic query using kibana, I replaced correlation\_id with correlation\_id.keyword which solved the problem.

But if I use .keyword in ruby filter, error is thrown.  
response = client.search index: 'perf\_report\_by\_audit\_and\_jmeter', body: { query: { match: { ' **correlation\_id.keyword'** : event.get('correlation\_id') } } }

eval at org/jruby/RubyKernel.java:1079  
register at /bpms/ELK/logstash-5.6.3/vendor/bundle/jruby/1.9/gems/logstash-filter-ruby-3.0.4/lib/logstash/filters/ruby.rb:38  
register at /bpms/ELK/logstash-5.6.3/vendor/jruby/lib/ruby/1.9/forwardable.rb:201  
register\_plugin at /bpms/ELK/logstash-5.6.3/logstash-core/lib/logstash/pipeline.rb:290  
register\_plugins at /bpms/ELK/logstash-5.6.3/logstash-core/lib/logstash/pipeline.rb:301  
each at org/jruby/RubyArray.java:1613  
register\_plugins at /bpms/ELK/logstash-5.6.3/logstash-core/lib/logstash/pipeline.rb:301  
start\_workers at /bpms/ELK/logstash-5.6.3/logstash-core/lib/logstash/pipeline.rb:311  
run at /bpms/ELK/logstash-5.6.3/logstash-core/lib/logstash/pipeline.rb:235  
start\_pipeline at /bpms/ELK/logstash-5.6.3/logstash-core/lib/logstash/agent.rb:398

Please assist

---

<div class="post-metadata">

**Author:** ![Rajkumar\_Selvakumar](https://avatars.discourse-cdn.com/v4/letter/r/a88e4f/32.png) [@Rajkumar\_Selvakumar](https://discuss.elastic.co/u/Rajkumar_Selvakumar)\
**Post date:** [June 25, 2018, 2:36am UTC](https://discuss.elastic.co/t/issue-with-keyword-in-ruby-filter/134743/2 "2018-06-25T02:36:52Z")

</div>

Found that .keyword is not supported by ruby elastic search gem.  
Have found a workaround my forming custome index fields using MD5 hash and simple concatenation to overcome, text based search.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 23, 2018, 2:36am UTC](https://discuss.elastic.co/t/issue-with-keyword-in-ruby-filter/134743/3 "2018-07-23T02:36:58Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
