# Search Query with Lucene Query issue

**URL:** <https://discuss.elastic.co/t/search-query-with-lucene-query-issue/251727>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [October 12, 2020, 8:13am UTC](https://discuss.elastic.co/t/search-query-with-lucene-query-issue/251727 "2020-10-12T08:13:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![sikeeoh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sikeeoh/32/64782_2.png) [@sikeeoh](https://discuss.elastic.co/u/sikeeoh)\
**Post date:** [October 12, 2020, 8:13am UTC](https://discuss.elastic.co/t/search-query-with-lucene-query-issue/251727/1 "2020-10-12T08:13:31Z")

</div>

##### Search Query with Lucene Query Syntax

**If there are more than 4 OR or AND conditions, it does not work properly.**

query : "ten" OR "teen" OR "alask"

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/d/3/d3139f4f71eda69f962ee3ce683296fa290d1036.png)

query : "ten" OR "teen" OR "alask" OR "hihi" OR "bye"

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/e/1e1bdfce5247b5e34b2ce30443fa753acc065228.png)

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [October 15, 2020, 7:33am UTC](https://discuss.elastic.co/t/search-query-with-lucene-query-issue/251727/2 "2020-10-15T07:33:02Z")

</div>

This looks like a bug which I was able to reproduce. I opened an issue

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [October 16, 2020, 8:38am UTC](https://discuss.elastic.co/t/search-query-with-lucene-query-issue/251727/3 "2020-10-16T08:38:04Z")

</div>

The logic looks to be that there's an (undocumented) setting that 49% of the ORed terms must be matched. I don't think there's currently a way for you to relax this setting in your requests,

---

<div class="post-metadata">

**Author:** ![sikeeoh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sikeeoh/32/64782_2.png) [@sikeeoh](https://discuss.elastic.co/u/sikeeoh)\
**Post date:** [October 16, 2020, 8:54am UTC](https://discuss.elastic.co/t/search-query-with-lucene-query-issue/251727/4 "2020-10-16T08:54:00Z")

</div>

thx, @Mark_Harwood

Is it impossible to adjust later?

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [October 16, 2020, 9:08am UTC](https://discuss.elastic.co/t/search-query-with-lucene-query-issue/251727/5 "2020-10-16T09:08:21Z")

</div>

The code is unfamiliar to me but looks to allow an override for all search requests. I don't know how sysadmins get to change this though so I'll leave it to a member of the app-search team to respond.

---

<div class="post-metadata">

**Author:** ![sikeeoh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sikeeoh/32/64782_2.png) [@sikeeoh](https://discuss.elastic.co/u/sikeeoh)\
**Post date:** [October 16, 2020, 9:10am UTC](https://discuss.elastic.co/t/search-query-with-lucene-query-issue/251727/6 "2020-10-16T09:10:38Z")

</div>

thank you, @Mark_Harwood

When we input event words, we convert them into multiple words and then weave them with OR, so there are many cases where more than four are combined.

---

<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:** [November 13, 2020, 9:10am UTC](https://discuss.elastic.co/t/search-query-with-lucene-query-issue/251727/7 "2020-11-13T09:10:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [June 18, 2021, 6:46am UTC](https://discuss.elastic.co/t/search-query-with-lucene-query-issue/251727/8 "2021-06-18T06:46:39Z")

</div>

You could try using brackets to ensure there’s only max 2 clauses in between each bracket pair eg  
( A or ( B or ( C or D) ) )

Not tried it and it’s ugly but it might work.
