Correct elasticsearch for google like query

Hi,

Can I ask your recommendation on what query should I use for google-like search on documents. Also I need support for special characters. Whenever we use or if special characters are included, our query doesn't return expected results. Also we are querying across multiple fields (text & keyword field mapping)

Thank you for accommodating my question.

hey,

can you be more specific what a google like search is? Do you have some examples including the expected behaviour? A google like search can be interpreted very differently by different people.

Also, please include examples if a search is not working as expected along with documents being indexed, otherwise helping will be really hard.

Last but not least, if you expect some more out of the box features, you might want to take a look at App Search - which you can also run for free or use a hosted solution.

1 Like

Hello Alexander,

Google like search for me is for example i have these data,

Doc 1 = "sample@gmail.com"
Doc 2 ="test#424235.2525"
Doc 3 ="account-143441-jkgljds"

if i search @gmail i expect to return doc 1
if i search 5.25 expectation is to return doc 2
if i t-143 expectation is to return doc 3

Hey,

so just in those three requests there a ton of requirements are hidden. I.e. partial matching and splitting on certain characters.

I highly encourage you to the definitive guide and its chapter Search in depth, despite being a bit older it's still a great resource about the fundamentals of search.

See https://www.elastic.co/guide/en/elasticsearch/guide/master/search-in-depth.html

Another good resource is the analyze API to understand how a term is stored in the inverted index in order to understand what is actually searched for. See https://www.elastic.co/guide/en/elasticsearch/reference/7.3/indices-analyze.html

hope this helps as a start!

--Alex

1 Like

You would need to create you own analyzer using the ngram tokenizer for that.

1 Like

This is a good help for me to start of with. Thank you.

Thank you so much for your help. Will look into this one. This is a great help for me.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.