elasticsearch,elastic4s,Scala,elasticsearch,Elastic4s" /> elasticsearch,elastic4s,Scala,elasticsearch,Elastic4s" />

Scala elasticsearch“;更像这样;在elastic4s布尔查询中

Scala elasticsearch“;更像这样;在elastic4s布尔查询中,scala,elasticsearch,elastic4s,Scala,elasticsearch,Elastic4s,我正在使用elastic4s 1.5.10,并试图建立一个我在elasticsarch REST端点上准备的查询。现在尝试重写为Elastic4SDSL POST /index_name/type/_search { "_source":{"include":["name","surname"]}, "query": { "bool": { "must": [ { "more_like_this":

我正在使用elastic4s 1.5.10,并试图建立一个我在elasticsarch REST端点上准备的查询。现在尝试重写为Elastic4SDSL

POST /index_name/type/_search
{
    "_source":{"include":["name","surname"]},
   "query": {
      "bool": {
         "must": [
            {
               "more_like_this": {
                  "fields": ["desc"],
                  "ids": ["472825948"],
                  "min_term_freq":0,
                  "max_query_terms":200
               }
            },
            {
               "match": {"city": "London"}
            }, 
            {
               "match": {"operation": "add"}
            }
         ]
      }
   }
}
此查询的目标是获取与472825948相似的项,该项在同一城市(伦敦)具有相同的操作(添加)

我对elastic4s的尝试如下:

es_client.execute{
      search in  s"$storage_folder/${typ.name()}" query bool(    
        must(
          morelike id adId in s"$storage_folder/${typ.name()}" fields("desc") minTermFreq(0) maxQueryTerms(200),
          matchQuery(field="city",value = "London"),
          matchQuery(field="operation",value = "add"))
      )sourceInclude("name","surname")
    }
  }
“morelike”在这种情况下不起作用。要么原始json中的查询没有意义,要么elastic4s不支持此功能,要么

有人能帮忙吗


Thx

为了完整起见,我在这里也得到了回复。
morelike
e表示请求类型,
morelikeThisQuery
是正确的查询形式。因此,结果查询应该如下所示

es_client.execute{
      search in  s"$storage_folder/${typ.name()}" query bool(    
        must(
          morelikeThisQuery fields("desc")  ids(adId) minTermFreq(0) maxQueryTerms(200),
          matchQuery(field="city",value = "London"),
          matchQuery(field="operation",value = "add"))
      )sourceInclude("name","surname")
    }
  }