Elasticsearch regexp on query -


i have following query works great:

query: {   multi_match: {    fields: ["first_name", "last_name", "email", "sku"],    query: query,    type: "cross_fields",    operator: "and" } 

however, i'd have incoming query rid of non-alphanumeric characters, using regex:

[^a-za-z0-9\ @\.] 

is there way have elasticsearch filter incoming query regex fields?

you can specify different analyzer search during query construction.

query: {   multi_match: {    fields: ["first_name", "last_name", "email", "sku"],    query: query,    type: "cross_fields",    operator: "and",    analyzer: "your-custom-analyzer" } 

you have provide definition of "your-custom-analyzer" in mapping. analyzer definition can use pattern replace filter meet requirement.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -