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
Post a Comment