Trying AUI Select 2 drop down field

We are tying to use the Select2 drop down field to populate the values from backend rest details in dropdown. Able to filter the populate the results but not able to filters the results by search results. Also when we submitted the form, the details retains the results. Pls advice, how we can implement this one. Any advices