# Searching does not work in one of the index

**URL:** <https://forum.opensearch.org/t/searching-does-not-work-in-one-of-the-index/14368>\
**Category:** OpenSearch Dashboards\
**Tags:** troubleshoot\
**Created:** [May 17, 2023, 9:06am UTC](https://forum.opensearch.org/t/searching-does-not-work-in-one-of-the-index/14368 "2023-05-17T09:06:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![raj1209](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/raj1209/32/6115_2.png) [@raj1209](https://forum.opensearch.org/u/raj1209)\
**Post date:** [May 17, 2023, 9:06am UTC](https://forum.opensearch.org/t/searching-does-not-work-in-one-of-the-index/14368/1 "2023-05-17T09:06:03Z")

</div>

(relevant - OpenSearch/Dashboard/Server OS/Browser):  
opensearch version : 2.3.0  
Opensearch Dashboard version : 2.3.0  
Broswer : Chrome ( Tested with Mozilla, Brave, safari )

**Describe the issue** :

Searching was working good with out any issues but 2 days earlier it started to throw below exception

Bad Request

```auto
null_pointer_exception
Cannot invoke "org.opensearch.search.aggregations.InternalAggregations.getSerializedSize()" because "reducePhase.aggregations" is null

```

Error: Bad Request  
at Fetch.\_callee3$ ([https://hidden.net/4104/bundles/core/core.entry.js:15:584612](https://hidden.net/4104/bundles/core/core.entry.js:15:584612))  
at tryCatch ([https://hidden.net/4104/bundles/plugin/queryWorkbenchDashboards/queryWorkbenchDashboards.plugin.js:2:2179](https://hidden.net/4104/bundles/plugin/queryWorkbenchDashboards/queryWorkbenchDashboards.plugin.js:2:2179))  
at Generator.\_invoke ([https://hidden.net/4104/bundles/plugin/queryWorkbenchDashboards/queryWorkbenchDashboards.plugin.js:2:1802](https://hidden.net/4104/bundles/plugin/queryWorkbenchDashboards/queryWorkbenchDashboards.plugin.js:2:1802))  
at Generator.next ([https://hidden.net/4104/bundles/plugin/queryWorkbenchDashboards/queryWorkbenchDashboards.plugin.js:2:2954](https://hidden.net/4104/bundles/plugin/queryWorkbenchDashboards/queryWorkbenchDashboards.plugin.js:2:2954))  
at fetch\_asyncGeneratorStep ([https://hidden.net/4104/bundles/core/core.entry.js:15:577704](https://hidden.net/4104/bundles/core/core.entry.js:15:577704))  
at \_next ([https://hidden.net/4104/bundles/core/core.entry.js:15:578020](https://hidden.net/4104/bundles/core/core.entry.js:15:578020))

```auto

```

Attached screen shot below, can you please help me what the error meant

Thank you!

**Configuration** :

**The search term is “objects”**

**Relevant Logs or Screenshots** :

 ![image](https://us1.discourse-cdn.com/flex019/uploads/mauve_hedgehog/original/2X/0/0d78c378a204448dfeb2f77f81725bdd74092cef.png)

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [May 19, 2023, 2:40pm UTC](https://forum.opensearch.org/t/searching-does-not-work-in-one-of-the-index/14368/2 "2023-05-19T14:40:06Z")

</div>

@raj1209 Could you check the free disk space on your data nodes?

---

<div class="post-metadata">

**Author:** ![retorpigs](https://avatars.discourse-cdn.com/v4/letter/r/3be4f8/32.png) [@retorpigs](https://forum.opensearch.org/u/retorpigs)\
**Post date:** [May 22, 2023, 6:32pm UTC](https://forum.opensearch.org/t/searching-does-not-work-in-one-of-the-index/14368/3 "2023-05-22T18:32:43Z")

</div>

I’m having the same problem, and I have plenty of free space on all nodes

---

<div class="post-metadata">

**Author:** ![raj1209](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/raj1209/32/6115_2.png) [@raj1209](https://forum.opensearch.org/u/raj1209)\
**Post date:** [May 23, 2023, 2:17pm UTC](https://forum.opensearch.org/t/searching-does-not-work-in-one-of-the-index/14368/4 "2023-05-23T14:17:14Z")

</div>

Its not the disk space issue and I have enough or more free space.

This is the error I am getting in Dev Tool  
{  
“error” : {  
“root\_cause” : [  
{  
“type” : “query\_shard\_exception”,  
“reason” : “failed to create query: field expansion matches too many fields, limit: 1024, got: 1276”,  
“type” : “search\_phase\_execution\_exception”,  
“reason” : “”,

```
"caused_by" : {
  "type" : "null_pointer_exception",
  "reason" : "Cannot invoke \"org.opensearch.search.aggregations.InternalAggregations.getSerializedSize()\" because \"reducePhase.aggregations\" is null"
}

```

},

---

<div class="post-metadata">

**Author:** ![raj1209](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/raj1209/32/6115_2.png) [@raj1209](https://forum.opensearch.org/u/raj1209)\
**Post date:** [May 23, 2023, 2:24pm UTC](https://forum.opensearch.org/t/searching-does-not-work-in-one-of-the-index/14368/5 "2023-05-23T14:24:13Z")

</div>

Search works when you search with field name but not when just the value

Example 1 :

type : “objects” - search works fine ( note : type is just one of the field inside logs )

Example 2 :

“objects” - This search does not work and throws the above exception.

Is it because search is going through/indexing the documents above the limit set ?  
i came across the below 2 forums while searching for solution

Forum1 : [Error since 7.4 upgrade - field expansion matches too many fields - Elasticsearch - Discuss the Elastic Stack](https://discuss.elastic.co/t/error-since-7-4-upgrade-field-expansion-matches-too-many-fields/204087)

Forum 2 - [Elastic Search: failed to create query: field expansion matches too many fields, limit: 1024, got: 1399 - myVesta](https://forum.myvestacp.com/viewtopic.php?t=640)

In forum it says to increase the count of the parameter in opensearch.yml file **“indices.query.bool.max\_clause\_count: 4096”**

I’m not sure if the above line works or safe to do  
Can you please suggest on this.

Thank you

---

<div class="post-metadata">

**Author:** ![retorpigs](https://avatars.discourse-cdn.com/v4/letter/r/3be4f8/32.png) [@retorpigs](https://forum.opensearch.org/u/retorpigs)\
**Post date:** [May 23, 2023, 5:06pm UTC](https://forum.opensearch.org/t/searching-does-not-work-in-one-of-the-index/14368/6 "2023-05-23T17:06:21Z")

</div>

I solved the issue for me. the solution was to update the following setting on the indices in question:

```auto
PUT /index_pattern-*/_settings
{
	"index.max_docvalue_fields_search" : "200"
}

```

I figured this out by running the request as a curl, which gave me a useful error, that gave me the solution. I did this by going to to chrome dev tools, going to the discover page in opensearch, and selecting the offending index pattern. If you go to the network tab, you can see the request that’s used for the discover query. right click, and copy as curl. Run that in a terminal, and you might get a more helpful error.

---

<div class="post-metadata">

**Author:** ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/10363_2.png) [@pablo](https://forum.opensearch.org/u/pablo)\
**Post date:** [May 23, 2023, 5:24pm UTC](https://forum.opensearch.org/t/searching-does-not-work-in-one-of-the-index/14368/7 "2023-05-23T17:24:31Z")

</div>

@raj1209 According to OpenSearch documentation `indices.query.bool.max_clause_count:` has value 4096 assigned by default.

> Searching all eligible fields could be a resource-intensive operation. The `indices.query.bool.max_clause_count` search setting defines the maximum value for the product of the number of fields and the number of terms that can be queried at one time. The default value for `indices.query.bool.max_clause_count` is 4,096.

> **[Query string queries](https://opensearch.org/docs/2.3/opensearch/query-dsl/full-text/query-string/)**
>
> Query string queries

However, in the code SearchModule.java the default is set to 1024

> <https://github.com/opensearch-project/OpenSearch/blob/7d3e8c7fc5815bbcefe7f552e49538b28c0f5be2/server/src/main/java/org/opensearch/search/SearchModule.java#L318>

As per documentation, increasing the max value of that setting would impact the search performance.

---

<div class="post-metadata">

**Author:** ![raj1209](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/raj1209/32/6115_2.png) [@raj1209](https://forum.opensearch.org/u/raj1209)\
**Post date:** [May 24, 2023, 5:53am UTC](https://forum.opensearch.org/t/searching-does-not-work-in-one-of-the-index/14368/8 "2023-05-24T05:53:52Z")

</div>

So is it advised to search with field name instead of searching only value or messages  
This does not happens in all the index though, I’m currently facing with one index now.  
This is how it concludes or is there anything you advise on this.

Thank you
