masking - How to do a masked query in Elasticsearch? -


for example, storing user passports in elasticsearch. stored consecutive letters , digits of following format: aaddddddd. 2 alphabet , 7 digits.

user interested in search mention specific values specific positions. example, want search passport numbers have 'a' @ beginning, '7' in third position , '0' in last position. this:

a-7----0 

how generate efficient query this? need create custom analyzer this?

so far i've done inserted space in between characters , searching index position, seems costly operation me.

how efficient query need? if data not big can try regexp query https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html

other suggest use document array of symbols , places. ex.

   {         'code' : [            {'pos':1, 'symbol':a},{'pos':2, 'symbol':b}, ...         ]     }  

then can use bool filter, , efficiently use filter cache


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -