Should I Ajax or should I store the whole collection into a variable ?

I am building a single page app.
The app has a list of 7000 ports stored in a MongoDB database.
I need to be able to search for those ports with autocomplete on the search.
Should I Ajax the autocomplete results ?
OR
Should I retrieve the whole collection of ports, store it in a variable, plug my autocomplete on this array ?
What's the best practice ?
What's the smartest performance wise ?  

Best practice and smartest performance wise is to:

Send the search string to an API resource, example: 
/autocomplete?search=portname1

Retrieve the autocomplete results and visualize them
You can use existing JS libraries for autocomplete (avoid discovering the hot water)