Elasticsearch: Find substring match

后端 未结 2 1251
一生所求
一生所求 2020-12-07 16:01

I want to perform both exact word match and partial word/substring match. For example if I search for \"men\'s shaver\" then I should be able to find \"men\'s shaver\" in th

2条回答
  •  天涯浪人
    2020-12-07 16:22

    By searching with any string or substring Use:

    query: {
        or: [{
          match_phrase_prefix: {
                name: str
         }
        }, {
            match_phrase_prefix: {
                surname: str
            }
        }]
    }
    

    Happy coding with Elastic Search....

提交回复
热议问题