我是 Elasticsearch 的新手。请帮助我找到要编写的过滤器/查询以匹配使用 Java API 的确切记录。

Below is the mongodb record .I need to get both the record matching the word 'Jerry' using elastic search.

{
        "searchcontent" : [
                {
                        "key" : "Jerry",
                        "sweight" : "1"
                },{
                        "key" : "Kate",
                        "sweight" : "1"
                },

        ],
        "contentId" : "CON_4",
        "keyword" : "TEST",
        "_id" : ObjectId("55ded619e4b0406bbd901a47")
},
{
        "searchcontent" : [
                {
                        "key" : "TOM",
                        "sweight" : "2"
                },{
                        "key" : "Kruse",
                        "sweight" : "2"
                }

        ],
        "contentId" : "CON_3",
        "keyword" : "Jerry",
        "_id" : ObjectId("55ded619e4b0406ccd901a47")
}

最佳答案

如果您想在所有领域中进行搜索。
然后你可以做一个 match _all 查询,

POST <index name>/<type name>/_search.
     {
     "query": {
        "match" : {
            "_all" : "Jerry"
            }
        }
    }

这将在所有字段中搜索“Jerry”。

关于elasticsearch - Elasticsearch 过滤器,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32264571/

10-11 09:00
查看更多