# Fetch\_size not working for SQL query

**URL:** <https://forum.opensearch.org/t/fetch-size-not-working-for-sql-query/12210>\
**Category:** OpenSearch\
**Created:** [January 20, 2023, 12:33pm UTC](https://forum.opensearch.org/t/fetch-size-not-working-for-sql-query/12210 "2023-01-20T12:33:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bimlesh\_singh](https://avatars.discourse-cdn.com/v4/letter/b/898d66/32.png) [@bimlesh\_singh](https://forum.opensearch.org/u/bimlesh_singh)\
**Post date:** [January 20, 2023, 12:33pm UTC](https://forum.opensearch.org/t/fetch-size-not-working-for-sql-query/12210/1 "2023-01-20T12:33:45Z")

</div>

**Versions** (relevant - OpenSearch/Dashboard/Server OS/Browser):  
Opensearch-2.4.1  
Server -CentOs7

**Describe the issue** :  
We have created index as 2(integer not any String value).

We have below sample documents in OpenSearch repository-  
Doc-1==========================  
{  
“\_index”: “2”,  
“\_id”: “1411”,  
“\_score”: 1.0,  
“\_source”: {  
“type”: “ITEM”,  
“companyName”: “test1”,  
“containerName”: “catalog”,  
“identifier”: “1411”,  
“primaryKey”: “cat4item1”,  
“displayName”: “www”,  
“attributes”: {  
“cat\_specs”: {  
“item\_id”: “cat4item1”,  
“item\_name”: “www”,  
“item\_description”: null,  
“item\_exp\_date”: null,  
“item price”: 2000.0,  
“Reference Field”: {}  
}  
},  
“mappings”: {  
“hier”: [  
“cat4”  
]  
},  
“versionNumber”: 4  
}  
}  
Doc-2===============================================  
{  
“\_index”: “2”,  
“\_id”: “1411”,  
“\_score”: 1.0,  
“\_source”: {  
“type”: “ITEM”,  
“companyName”: “test1”,  
“containerName”: “catalog”,  
“identifier”: “1411”,  
“primaryKey”: “cat4item1”,  
“displayName”: “www”,  
“attributes”: {  
“cat\_specs”: {  
“item\_id”: “cat4item1”,  
“item\_name”: “www”,  
“item\_description”: null,  
“item\_exp\_date”: null,  
“item price”: 2000.0,  
“Reference Field”: {}  
}  
},  
“mappings”: {  
“hier”: [  
“cat4”  
]  
},

```
	"versionNumber": 4
}

```

}  
We need to find the records/documents which does not follow certain condition -  
HTTP METHOD: POST  
URL:/\_plugins/\_sql  
Body:  
{“query”:“SELECT count(\*) FROM `2` WHERE companyName = ‘test1’ AND containerName = ‘catalog’ AND NOT ((((`attributes.cat_specs.item_id` IS NOT NULL) AND (` **attributes.cat\_specs.item price** ` = 2000))))”,  
**“fetch\_size”:100**  
}

**Observation:** if index is integer, then we need to apply the backtick to make it STRING.

We had to use back tick (`) as one of the document attribute ( **item price** ) is having space between attribute name.

The query does not work if **fetch\_size** is added to query like given above-

Please suggest if any modification needed in query

**Configuration** :

**Relevant Logs or Screenshots** :

---

<div class="post-metadata">

**Author:** ![bimlesh\_singh](https://avatars.discourse-cdn.com/v4/letter/b/898d66/32.png) [@bimlesh\_singh](https://forum.opensearch.org/u/bimlesh_singh)\
**Post date:** [January 30, 2023, 6:01am UTC](https://forum.opensearch.org/t/fetch-size-not-working-for-sql-query/12210/2 "2023-01-30T06:01:31Z")

</div>

Hi ,Can someone have a look
