How can i do for prevent optgroup in search

Hello, i need no show the optgroup like record in search. Its that possible?
En castellano
Necesito que no se haga la busqueda sobre el optgroup, sino solo sobre los options
Gracias
Maxi

Use a custom matcher. As the user types their search term, Select2 passes the search term and each top-level item (an <option> or <optgroup>) to your custom matcher function.

The example code here is almost exactly what you need. The only difference is that you will also need to check for a match if the data item does not contain a children property. (In the example, they are only interested in matching <optgroup> children, so they always return null for top-level <option>s. You will want to match against those items as well as children of <optgroup>s.)