How do I do a partial match in Elasticsearch?

前端 未结 6 1956
一整个雨季
一整个雨季 2020-12-15 16:14

I have a link like http://drive.google.com and I want to match \"google\" out of the link.

I have:

query: {
    bool : {
        must: {
                    


        
6条回答
  •  醉梦人生
    2020-12-15 16:28

    For a more generic solution you can look into using a different analyzer or defining your own. I am assuming you are using the standard analyzer which would split http://drive.google.com into the tokens "http" and "drive.google.com". This is why the search for just google isn't working because it is trying to compare it to the full "drive.google.com".

    If instead you indexed your documents using the simple analyzer it would split it up into "http", "drive", "google", and "com". This will allow you to match anyone of those terms on their own.

提交回复
热议问题