Aggregation query to fetch item list

Hi All,

We have an index es_item. The document count of es_item is 205,059,966 with nearly 850 GB primary size. Index es_item contains standards items along with cross codes (For example:- Each standard_item will have more than one cross codes). The cross codes are nothing but sub document of each item.
For our analyzing purpose we would like to know,
How to get standard item's of having more than 10,000 cross codes?

Below query will fetch total cross code count of an item (based of item id). My doubt is if XCD is greater than 10,000 then it should fetch all items having matched the criteria. Please guide us

Sample Query:-
GET es_item/item/_search
"query": {
"filtered": {
"filter": {
"term": {
"_id": "4356760"
"fields": [
"script_fields": {
"FIELD": {
"script": "return _source.XCD.size()"

Ganeshbabu R