所有由zhufenghua发布的文章

elasticSearch使用 inner_hits 同时返回父子文档

es 父子文档,同时返回父子文档时, inner_hits 参数比较重要。

它有4个参数:

from偏移量
size指定返回的数量,默认为3
sort排序,默认以评分排序
nameinner_hits 别名,如果缺省,则默认为type名
GET inndex_name/_search
{
    "query": {
        "has_child" : {
            "type" : "product",  // 子类型
            "query" : {
                "match_all" : {}
            },
            "max_children": 10,
            "min_children": 1, 
            "score_mode" : "min",
            "inner_hits": {  // 返回其子文档,如果没有这个参数则只返回父文档
              "size": 10
            }
        }
    }
}

如果使用默认值,则传递一个空的对象 ,也就是 {} 作为 inner_hits即可。

多个查询时,会报错,[inner_hits] already contains an entry for key [product] ,这里的 product 是默认的子类型type,所以也会使用 product 作为子类型名,而一个搜索多个 has_child 并且为同一个type时,就会报上述的错误,此时使用 inner_hits 的 name 字段使用别名,比如 product2。然后在返回值中,判断 product 或 product2 就是返回的 inner_hits。

英文词汇 torn

adj.犹豫的;举棋不定的v.撕裂;撕碎;扯破;戳破;撕开,划成,刺出,扯开(裂口或洞);拉掉;撕掉;拔掉;扯掉tear的过去分词

I’m torn between the two dresses. Which one should I wear?

如果只是单纯表示纠结,直接说I’m torn即可。

I’m in a dilemma. 我进退两难啊,纠结不知如何做啊。

decide对应的形容词是:decisive 表示一个人很有决断力,很果断的。

和decisive相反的形容词就是:indecisive 表示一个人很犹豫不决的,很迟疑的。

I like decisive leaders not the indecisive ones.

我喜欢有决断力的领导,而不是那些优柔寡断的。

英文词汇 shocked

  • v.使震惊;使惊愕;使气愤;使厌恶
  • shock的过去分词和过去式
  • 通常用于不太好的惊讶,而不是惊喜

Shocking: 让人震惊的

Startled: 惊吓、被吓了一跳

Startling: 让人惊吓的、完全出人意料的,通常是比较负面的

Unexpected: 出人意料的。注意,这个词是形容让人出人意料的事情,而不是你的感受。

Flabbergasted: 大吃一惊

Dumbfounded: 目瞪口呆

Stupefied: 惊呆了,匪夷所思

这三个词都是形容人的感受。用在句子里,可以这么说:

I was+…, 比如 I was so flabbergasted by the news

Out of the blue:出乎意料、非常突然。常用在一个很久没联络的老朋友突然联系你。这个短语千万别忘了中间的 the。

My old college roommate contacted me today out of the blue.

Out of nowhere: 意思和 out of the blue 非常像,更多用于形容实际物体或者一个想法突然显现。

最后,学几个短句

注意,时态基本都是用过去时

I didn’t see it coming: 我完全没料到

I totally didn’t expect that:同上

I never could have guessed:同上

Who knew? 谁知道会这样?