why does API responds with "exceeded node count limit of 100" even though, the node count is < 100?
Asked by AutomationUIUser:

I'm executing below mentioned API request:

<https://opshub.jiraalign.com/rest/align/api/2/Programs?$filter=portfolioId+eq+4+or+portfolioId+eq+8+or+portfolioId+eq+9+or+portfolioId+eq+10+or+portfolioId+eq+11+or+portfolioId+eq+12+or+portfolioId+eq+13+or+portfolioId+eq+14+or+portfolioId+eq+15+or+portfolioId+eq+16+or+portfolioId+eq+17+or+portfolioId+eq+18+or+portfolioId+eq+19+or+portfolioId+eq+20+or+portfolioId+eq+24+or+portfolioId+eq+26+or+portfolioId+eq+27+or+portfolioId+eq+29+or+portfolioId+eq+30+or+portfolioId+eq+31+or+portfolioId+eq+32>

The response of this contains **48 nodes**, still it gives error as:

"Cannot get programs. The node count limit of '100' has been exceeded. To increase the limit, set the 'MaxNodeCount' property on EnableQueryAttribute or ODataValidationSettings."  

What could be the possible cause of this behavior?


Answers:
author: Allan Maxwell
body: The simple answer is that your Filter clause is too long. I get the same error that you are getting, but if I delete the everything after the last "OR" clause, it works as expect.

comments: author: AutomationUIUser
body: With the last "OR" clause, the node count is only 48. Ideally, it should work regardless of length of filter clause


author: Allan Maxwell
body: [@AutomationUIUser](/t5/user/viewprofilepage/user-id/1450997) How are you defining "node count"? How do you determine node count is 48? I believe "Node Count" refers to the number of tokens in the SELECT clause.


author: AutomationUIUser
body: Definition of node count is fine, but how do I decide from query parameters that this query will not result in error?  
i.e. query given in the question itself, how do I decide that how many OR clause should I add? query up to "portfolio+eq+31" it will give proper result, but with last OR clause it will give error, so how do you define query parameter limit?


author: Allan Maxwell
body: I think "portfolioID eq 5 and" is four tokens, so you can only select 25 portfolios at a time.


author: AutomationUIUser
body: <https://opshub.jiraalign.com/rest/align/api/2/Programs?$filter=portfolioId+eq+4+or+portfolioId+eq+8+or+portfolioId+eq+9+or+portfolioId+eq+10+or+portfolioId+eq+11+or+portfolioId+eq+12+or+portfolioId+eq+13+or+portfolioId+eq+14+or+portfolioId+eq+15+or+portfolioId+eq+16+or+portfolioId+eq+17+or+portfolioId+eq+18+or+portfolioId+eq+19+or+portfolioId+eq+20+or+portfolioId+eq+24+or+portfolioId+eq+26+or+portfolioId+eq+27+or+portfolioId+eq+29+or+portfolioId+eq+30+or+portfolioId+eq+31+or+portfolioId+eq+32>

I'm passing this query, which has total 83 tokens. Still it gives error as:

"Cannot get programs. The node count limit of '100' has been exceeded. To increase the limit, set the 'MaxNodeCount' property on EnableQueryAttribute or ODataValidationSettings."

what could be the reason for this?


author: Allan Maxwell
body: you're query string parameters are still too abundant. The query about will work if you delete the last "OR" clause.


author: JJ Banda
body: I have the same issue: query ran with 79 tokens works just fine, add another 4 tokens and the API gives a 400 error.

There is clearly a limit to the number of filter conditionals (tokens) that can be used at once - what is that limit? It's not 100.