How to match on prefix in Elasticsearch

前端 未结 5 663
太阳男子
太阳男子 2020-12-30 02:49

let\'s say that in my elasticsearch index I have a field called \"dots\" which will contain a string of punctuation separated words (e.g. \"first.second.third\").

I

5条回答
  •  南笙
    南笙 (楼主)
    2020-12-30 03:11

    There is also a much easier way, as pointed out in elasticsearch documentation:

    just use:

    {
        "text_phrase_prefix" : {
            "fieldname" : "yourprefix"
        }
    }
    

    or since 0.19.9:

    {
        "match_phrase_prefix" : {
            "fieldname" : "yourprefix"
        }
    }
    

    instead of:

    {   
        "prefix" : { 
            "fieldname" : "yourprefix" 
    }
    

提交回复
热议问题