国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

elasticsearch結(jié)構(gòu)化查詢(一)

這篇具有很好參考價值的文章主要介紹了elasticsearch結(jié)構(gòu)化查詢(一)。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報違法"按鈕提交疑問。

在上一篇中我們介紹了DSL相關(guān)的知識,接下來我們將會學(xué)習(xí)elasticsearch的結(jié)構(gòu)化查詢,同時也實踐一下上一篇的DSL的查詢用法

什么是結(jié)構(gòu)化搜索?

從《Elasticsearch權(quán)威指南》上摘取部分解釋如下:

		結(jié)構(gòu)化搜索是指查詢包含內(nèi)部結(jié)構(gòu)的數(shù)據(jù)。日期,時間,和數(shù)字都是結(jié)構(gòu)化的:它們有明確的格式給你執(zhí)行邏輯
	操作。一般包括比較數(shù)字或日期的范圍,或確定兩個值哪個大。文本也可以被結(jié)構(gòu)化。一包蠟筆有不同的顏色:
	紅色 , 綠色 , 藍(lán)色 。一篇博客可能被打上 分布式 和 搜索 的標(biāo)簽。電子商務(wù)產(chǎn)品有商品統(tǒng)一代碼(UPCs)
	或其他有著嚴(yán)格格式的標(biāo)識。
		通過結(jié)構(gòu)化搜索,你的查詢結(jié)果始終是是或非;是否應(yīng)該屬于集合。結(jié)構(gòu)化搜索不關(guān)心文檔的相關(guān)性或分?jǐn)?shù),
	它只是簡單的包含或排除文檔。這必須是有意義的邏輯,一個數(shù)字不能比同一個范圍中的其他數(shù)字 更多。它只能
	包含在一個范圍中或不在其中。類似的,對于結(jié)構(gòu)化文本,一個值必須相等或不等。這里沒有更匹配的概念。

從上面的定義我們可以看出來結(jié)構(gòu)化查詢最重要的就是是否匹配么人并不是很關(guān)心相關(guān)性和分值計算。所以接下來我們將會一一介紹不同的結(jié)構(gòu)化查詢。

Term查詢

term 主要用于查找精確值,由于不需要計算分值,而且可以被緩存,所以速度很快,而且term查詢主要針對的是數(shù)字,日期,布爾值或 not_analyzed 的字符串(未經(jīng)分析的文本數(shù)據(jù)類型)。
首先我們使用term查詢一下:

GET bank/_search
{
  "query": {
    "term": {
      "firstname": {
        "value": "Burton"
      }
    }
  },
      "profile": "true"
}

返回結(jié)果:

{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : [ ]
  },
  "profile" : {
    "shards" : [
      {
        "id" : "[jW8PbSdhTOOpESX13DRBJQ][bank][0]",
        "searches" : [
          {
            "query" : [
              {
                "type" : "TermQuery",
                "description" : "firstname:Burton",
                "time_in_nanos" : 8729,
                "breakdown" : {
                  "set_min_competitive_score_count" : 0,
                  "match_count" : 0,
                  "shallow_advance_count" : 0,
                  "set_min_competitive_score" : 0,
                  "next_doc" : 0,
                  "match" : 0,
                  "next_doc_count" : 0,
                  "score_count" : 0,
                  "compute_max_score_count" : 0,
                  "compute_max_score" : 0,
                  "advance" : 0,
                  "advance_count" : 0,
                  "score" : 0,
                  "build_scorer_count" : 2,
                  "create_weight" : 7274,
                  "shallow_advance" : 0,
                  "create_weight_count" : 1,
                  "build_scorer" : 1455
                }
              }
            ],
            "rewrite_time" : 1222,
            "collector" : [
              {
                "name" : "SimpleTopScoreDocCollector",
                "reason" : "search_top_hits",
                "time_in_nanos" : 3132
              }
            ]
          }
        ],
        "aggregations" : [ ]
      }
    ]
  }
}

我們發(fā)現(xiàn)結(jié)果好像并不盡如人意,那么我們再試一個,這次我們把他修改成年齡字段搜索:

GET bank/_search
{
  "query": {
    "term": {
      "age": {
        "value": 36
      }
    }
  },
      "profile": "true"
}

返回結(jié)果:

{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 52,
      "relation" : "eq"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "6",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 6,
          "balance" : 5686,
          "firstname" : "Hattie",
          "lastname" : "Bond",
          "age" : 36,
          "gender" : "M",
          "address" : "671 Bristol Street",
          "employer" : "Netagy",
          "email" : "hattiebond@netagy.com",
          "city" : "Dante",
          "state" : "TN"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "361",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 361,
          "balance" : 23659,
          "firstname" : "Noreen",
          "lastname" : "Shelton",
          "age" : 36,
          "gender" : "M",
          "address" : "702 Tillary Street",
          "employer" : "Medmex",
          "email" : "noreenshelton@medmex.com",
          "city" : "Derwood",
          "state" : "NH"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "378",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 378,
          "balance" : 27100,
          "firstname" : "Watson",
          "lastname" : "Simpson",
          "age" : 36,
          "gender" : "F",
          "address" : "644 Thomas Street",
          "employer" : "Wrapture",
          "email" : "watsonsimpson@wrapture.com",
          "city" : "Keller",
          "state" : "TX"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "397",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 397,
          "balance" : 37418,
          "firstname" : "Leonard",
          "lastname" : "Gray",
          "age" : 36,
          "gender" : "F",
          "address" : "840 Morgan Avenue",
          "employer" : "Recritube",
          "email" : "leonardgray@recritube.com",
          "city" : "Edenburg",
          "state" : "AL"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "455",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 455,
          "balance" : 39556,
          "firstname" : "Lynn",
          "lastname" : "Tran",
          "age" : 36,
          "gender" : "M",
          "address" : "741 Richmond Street",
          "employer" : "Optyk",
          "email" : "lynntran@optyk.com",
          "city" : "Clinton",
          "state" : "WV"
        }
      }
    ]
  },
  "profile" : {
    "shards" : [
      {
        "id" : "[jW8PbSdhTOOpESX13DRBJQ][bank][0]",
        "searches" : [
          {
            "query" : [
              {
                "type" : "PointRangeQuery",
                "description" : "age:[36 TO 36]",
                "time_in_nanos" : 101095,
                "breakdown" : {
                  "set_min_competitive_score_count" : 0,
                  "match_count" : 0,
                  "shallow_advance_count" : 0,
                  "set_min_competitive_score" : 0,
                  "next_doc" : 10111,
                  "match" : 0,
                  "next_doc_count" : 52,
                  "score_count" : 52,
                  "compute_max_score_count" : 0,
                  "compute_max_score" : 0,
                  "advance" : 2175,
                  "advance_count" : 2,
                  "score" : 4530,
                  "build_scorer_count" : 4,
                  "create_weight" : 2346,
                  "shallow_advance" : 0,
                  "create_weight_count" : 1,
                  "build_scorer" : 81933
                }
              }
            ],
            "rewrite_time" : 1248,
            "collector" : [
              {
                "name" : "SimpleTopScoreDocCollector",
                "reason" : "search_top_hits",
                "time_in_nanos" : 76285
              }
            ]
          }
        ],
        "aggregations" : [ ]
      }
    ]
  }
}

根據(jù)上面的結(jié)果,我們再一次驗證了,term查詢只針對精確值、布爾值、日期以及未經(jīng)分析的字段,而如果我們用term去查詢一些單詞或者句子等,就會匹配不到對應(yīng)的值,為什么呢?官網(wǎng)其實也給出了解釋,在下圖中就可以看到,其實是因為我們es默認(rèn)的標(biāo)準(zhǔn)分詞器可能將我們要查詢的句子或者單詞變成小寫了,或者拆分了,而我們的term查詢又是精確查詢,所以不會分析我們的搜索字段的,從而導(dǎo)致term查詢一些單詞和短語時,很難得到滿意的結(jié)果。當(dāng)然這也是官方提醒我們要避免的,官方建議我們使用match來匹配查詢一些單詞和短語,效果要比term好。
傳送門
如圖所示:
elasticsearch結(jié)構(gòu)化查詢(一)
elasticsearch結(jié)構(gòu)化查詢(一)
這里我就不翻譯了,如果想學(xué)習(xí)更多,可以自行閱讀官方文檔。

Terms查詢

terms查詢其實就是類似整合多個term查詢。如例子所示:

GET bank/_search
{
  "query": {
    "terms": {
      "age": [36,27]
    }
  },
      "profile": "true"
}

返回結(jié)果:

{
  "took" : 3,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 91,
      "relation" : "eq"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "6",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 6,
          "balance" : 5686,
          "firstname" : "Hattie",
          "lastname" : "Bond",
          "age" : 36,
          "gender" : "M",
          "address" : "671 Bristol Street",
          "employer" : "Netagy",
          "email" : "hattiebond@netagy.com",
          "city" : "Dante",
          "state" : "TN"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "20",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 20,
          "balance" : 16418,
          "firstname" : "Elinor",
          "lastname" : "Ratliff",
          "age" : 36,
          "gender" : "M",
          "address" : "282 Kings Place",
          "employer" : "Scentric",
          "email" : "elinorratliff@scentric.com",
          "city" : "Ribera",
          "state" : "WA"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "102",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 102,
          "balance" : 29712,
          "firstname" : "Dena",
          "lastname" : "Olson",
          "age" : 27,
          "gender" : "F",
          "address" : "759 Newkirk Avenue",
          "employer" : "Hinway",
          "email" : "denaolson@hinway.com",
          "city" : "Choctaw",
          "state" : "NJ"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "133",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 133,
          "balance" : 26135,
          "firstname" : "Deena",
          "lastname" : "Richmond",
          "age" : 36,
          "gender" : "F",
          "address" : "646 Underhill Avenue",
          "employer" : "Sunclipse",
          "email" : "deenarichmond@sunclipse.com",
          "city" : "Austinburg",
          "state" : "SC"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "222",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 222,
          "balance" : 14764,
          "firstname" : "Rachelle",
          "lastname" : "Rice",
          "age" : 36,
          "gender" : "M",
          "address" : "333 Narrows Avenue",
          "employer" : "Enaut",
          "email" : "rachellerice@enaut.com",
          "city" : "Wright",
          "state" : "AZ"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "239",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 239,
          "balance" : 25719,
          "firstname" : "Chang",
          "lastname" : "Boyer",
          "age" : 36,
          "gender" : "M",
          "address" : "895 Brigham Street",
          "employer" : "Qaboos",
          "email" : "changboyer@qaboos.com",
          "city" : "Belgreen",
          "state" : "NH"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "328",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 328,
          "balance" : 12523,
          "firstname" : "Good",
          "lastname" : "Campbell",
          "age" : 27,
          "gender" : "F",
          "address" : "438 Hicks Street",
          "employer" : "Gracker",
          "email" : "goodcampbell@gracker.com",
          "city" : "Marion",
          "state" : "CA"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "342",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 342,
          "balance" : 33670,
          "firstname" : "Vivian",
          "lastname" : "Wells",
          "age" : 36,
          "gender" : "M",
          "address" : "570 Cobek Court",
          "employer" : "Nutralab",
          "email" : "vivianwells@nutralab.com",
          "city" : "Fontanelle",
          "state" : "OK"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "361",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 361,
          "balance" : 23659,
          "firstname" : "Noreen",
          "lastname" : "Shelton",
          "age" : 36,
          "gender" : "M",
          "address" : "702 Tillary Street",
          "employer" : "Medmex",
          "email" : "noreenshelton@medmex.com",
          "city" : "Derwood",
          "state" : "NH"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "378",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 378,
          "balance" : 27100,
          "firstname" : "Watson",
          "lastname" : "Simpson",
          "age" : 36,
          "gender" : "F",
          "address" : "644 Thomas Street",
          "employer" : "Wrapture",
          "email" : "watsonsimpson@wrapture.com",
          "city" : "Keller",
          "state" : "TX"
        }
      }
    ]
  },
  "profile" : {
    "shards" : [
      {
        "id" : "[jW8PbSdhTOOpESX13DRBJQ][bank][0]",
        "searches" : [
          {
            "query" : [
              {
                "type" : "PointInSetQuery",
                "description" : "age:{27 36}",
                "time_in_nanos" : 864841,
                "breakdown" : {
                  "set_min_competitive_score_count" : 0,
                  "match_count" : 0,
                  "shallow_advance_count" : 0,
                  "set_min_competitive_score" : 0,
                  "next_doc" : 3060,
                  "match" : 0,
                  "next_doc_count" : 91,
                  "score_count" : 91,
                  "compute_max_score_count" : 0,
                  "compute_max_score" : 0,
                  "advance" : 2277,
                  "advance_count" : 2,
                  "score" : 2482,
                  "build_scorer_count" : 4,
                  "create_weight" : 52628,
                  "shallow_advance" : 0,
                  "create_weight_count" : 1,
                  "build_scorer" : 804394
                }
              }
            ],
            "rewrite_time" : 1505,
            "collector" : [
              {
                "name" : "SimpleTopScoreDocCollector",
                "reason" : "search_top_hits",
                "time_in_nanos" : 17392
              }
            ]
          }
        ],
        "aggregations" : [ ]
      }
    ]
  }
}

當(dāng)然在term中需要注意的在這里同樣需要。terms也是同樣是精確查詢。這里提一嘴terms lookup的用法,先看lookup的例子:

GET bank/_search
{
  "query": {
    "terms": {
      "age": {
        "index" : "bank",
            "id" : "342",
            "path" : "age"
      }
    }
  },
      "profile": "true"
}

返回結(jié)果:

{
  "took" : 4,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 52,
      "relation" : "eq"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "6",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 6,
          "balance" : 5686,
          "firstname" : "Hattie",
          "lastname" : "Bond",
          "age" : 36,
          "gender" : "M",
          "address" : "671 Bristol Street",
          "employer" : "Netagy",
          "email" : "hattiebond@netagy.com",
          "city" : "Dante",
          "state" : "TN"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "20",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 20,
          "balance" : 16418,
          "firstname" : "Elinor",
          "lastname" : "Ratliff",
          "age" : 36,
          "gender" : "M",
          "address" : "282 Kings Place",
          "employer" : "Scentric",
          "email" : "elinorratliff@scentric.com",
          "city" : "Ribera",
          "state" : "WA"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "133",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 133,
          "balance" : 26135,
          "firstname" : "Deena",
          "lastname" : "Richmond",
          "age" : 36,
          "gender" : "F",
          "address" : "646 Underhill Avenue",
          "employer" : "Sunclipse",
          "email" : "deenarichmond@sunclipse.com",
          "city" : "Austinburg",
          "state" : "SC"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "222",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 222,
          "balance" : 14764,
          "firstname" : "Rachelle",
          "lastname" : "Rice",
          "age" : 36,
          "gender" : "M",
          "address" : "333 Narrows Avenue",
          "employer" : "Enaut",
          "email" : "rachellerice@enaut.com",
          "city" : "Wright",
          "state" : "AZ"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "239",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 239,
          "balance" : 25719,
          "firstname" : "Chang",
          "lastname" : "Boyer",
          "age" : 36,
          "gender" : "M",
          "address" : "895 Brigham Street",
          "employer" : "Qaboos",
          "email" : "changboyer@qaboos.com",
          "city" : "Belgreen",
          "state" : "NH"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "342",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 342,
          "balance" : 33670,
          "firstname" : "Vivian",
          "lastname" : "Wells",
          "age" : 36,
          "gender" : "M",
          "address" : "570 Cobek Court",
          "employer" : "Nutralab",
          "email" : "vivianwells@nutralab.com",
          "city" : "Fontanelle",
          "state" : "OK"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "361",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 361,
          "balance" : 23659,
          "firstname" : "Noreen",
          "lastname" : "Shelton",
          "age" : 36,
          "gender" : "M",
          "address" : "702 Tillary Street",
          "employer" : "Medmex",
          "email" : "noreenshelton@medmex.com",
          "city" : "Derwood",
          "state" : "NH"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "378",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 378,
          "balance" : 27100,
          "firstname" : "Watson",
          "lastname" : "Simpson",
          "age" : 36,
          "gender" : "F",
          "address" : "644 Thomas Street",
          "employer" : "Wrapture",
          "email" : "watsonsimpson@wrapture.com",
          "city" : "Keller",
          "state" : "TX"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "397",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 397,
          "balance" : 37418,
          "firstname" : "Leonard",
          "lastname" : "Gray",
          "age" : 36,
          "gender" : "F",
          "address" : "840 Morgan Avenue",
          "employer" : "Recritube",
          "email" : "leonardgray@recritube.com",
          "city" : "Edenburg",
          "state" : "AL"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "455",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 455,
          "balance" : 39556,
          "firstname" : "Lynn",
          "lastname" : "Tran",
          "age" : 36,
          "gender" : "M",
          "address" : "741 Richmond Street",
          "employer" : "Optyk",
          "email" : "lynntran@optyk.com",
          "city" : "Clinton",
          "state" : "WV"
        }
      }
    ]
  },
  "profile" : {
    "shards" : [
      {
        "id" : "[jW8PbSdhTOOpESX13DRBJQ][bank][0]",
        "searches" : [
          {
            "query" : [
              {
                "type" : "PointInSetQuery",
                "description" : "age:{36}",
                "time_in_nanos" : 137631,
                "breakdown" : {
                  "set_min_competitive_score_count" : 0,
                  "match_count" : 0,
                  "shallow_advance_count" : 0,
                  "set_min_competitive_score" : 0,
                  "next_doc" : 1715,
                  "match" : 0,
                  "next_doc_count" : 52,
                  "score_count" : 52,
                  "compute_max_score_count" : 0,
                  "compute_max_score" : 0,
                  "advance" : 1762,
                  "advance_count" : 2,
                  "score" : 1462,
                  "build_scorer_count" : 4,
                  "create_weight" : 1747,
                  "shallow_advance" : 0,
                  "create_weight_count" : 1,
                  "build_scorer" : 130945
                }
              }
            ],
            "rewrite_time" : 1454,
            "collector" : [
              {
                "name" : "SimpleTopScoreDocCollector",
                "reason" : "search_top_hits",
                "time_in_nanos" : 11493
              }
            ]
          }
        ],
        "aggregations" : [ ]
      }
    ]
  }
}

我理解的意思就是查詢與指定文檔id下的指定的字段的值一樣的文檔有哪些。效率雖然高,但是限制也比較多,可自行查看官網(wǎng)描述的相關(guān)限制,傳送門

range查詢

range查詢即范圍查詢,主要包括數(shù)字查詢和日期查詢,當(dāng)然也可以查詢文本,但是要將search.allow_expensive_queries設(shè)置為true。

查詢數(shù)字

查詢的結(jié)構(gòu)如下:

GET bank/_search
{
  "query": {
    "range": {
      "age": {
        "gte" : 27,
         "lt" : 36
      }
    }
  },
      "profile": "true"
}

其中范圍查詢的參數(shù)有:
gte:大于等于
gt:大于
lt:小于
lte:小于等于
format:主要用來格式化日期的
time_zone:時區(qū)
查詢數(shù)字的返回結(jié)果為:

{
  "took" : 15,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 436,
      "relation" : "eq"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "13",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 13,
          "balance" : 32838,
          "firstname" : "Nanette",
          "lastname" : "Bates",
          "age" : 28,
          "gender" : "F",
          "address" : "789 Madison Street",
          "employer" : "Quility",
          "email" : "nanettebates@quility.com",
          "city" : "Nogal",
          "state" : "VA"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "18",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 18,
          "balance" : 4180,
          "firstname" : "Dale",
          "lastname" : "Adams",
          "age" : 33,
          "gender" : "M",
          "address" : "467 Hutchinson Court",
          "employer" : "Boink",
          "email" : "daleadams@boink.com",
          "city" : "Orick",
          "state" : "MD"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "32",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 32,
          "balance" : 48086,
          "firstname" : "Dillard",
          "lastname" : "Mcpherson",
          "age" : 34,
          "gender" : "F",
          "address" : "702 Quentin Street",
          "employer" : "Quailcom",
          "email" : "dillardmcpherson@quailcom.com",
          "city" : "Veguita",
          "state" : "IN"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "51",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 51,
          "balance" : 14097,
          "firstname" : "Burton",
          "lastname" : "Meyers",
          "age" : 31,
          "gender" : "F",
          "address" : "334 River Street",
          "employer" : "Bezal",
          "email" : "burtonmeyers@bezal.com",
          "city" : "Jacksonburg",
          "state" : "MO"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "56",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 56,
          "balance" : 14992,
          "firstname" : "Josie",
          "lastname" : "Nelson",
          "age" : 32,
          "gender" : "M",
          "address" : "857 Tabor Court",
          "employer" : "Emtrac",
          "email" : "josienelson@emtrac.com",
          "city" : "Sunnyside",
          "state" : "UT"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "63",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 63,
          "balance" : 6077,
          "firstname" : "Hughes",
          "lastname" : "Owens",
          "age" : 30,
          "gender" : "F",
          "address" : "510 Sedgwick Street",
          "employer" : "Valpreal",
          "email" : "hughesowens@valpreal.com",
          "city" : "Guilford",
          "state" : "KS"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "70",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 70,
          "balance" : 38172,
          "firstname" : "Deidre",
          "lastname" : "Thompson",
          "age" : 33,
          "gender" : "F",
          "address" : "685 School Lane",
          "employer" : "Netplode",
          "email" : "deidrethompson@netplode.com",
          "city" : "Chestnut",
          "state" : "GA"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "94",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 94,
          "balance" : 41060,
          "firstname" : "Brittany",
          "lastname" : "Cabrera",
          "age" : 30,
          "gender" : "F",
          "address" : "183 Kathleen Court",
          "employer" : "Mixers",
          "email" : "brittanycabrera@mixers.com",
          "city" : "Cornucopia",
          "state" : "AZ"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "102",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 102,
          "balance" : 29712,
          "firstname" : "Dena",
          "lastname" : "Olson",
          "age" : 27,
          "gender" : "F",
          "address" : "759 Newkirk Avenue",
          "employer" : "Hinway",
          "email" : "denaolson@hinway.com",
          "city" : "Choctaw",
          "state" : "NJ"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "107",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 107,
          "balance" : 48844,
          "firstname" : "Randi",
          "lastname" : "Rich",
          "age" : 28,
          "gender" : "M",
          "address" : "694 Jefferson Street",
          "employer" : "Netplax",
          "email" : "randirich@netplax.com",
          "city" : "Bellfountain",
          "state" : "SC"
        }
      }
    ]
  },
  "profile" : {
    "shards" : [
      {
        "id" : "[jW8PbSdhTOOpESX13DRBJQ][bank][0]",
        "searches" : [
          {
            "query" : [
              {
                "type" : "IndexOrDocValuesQuery",
                "description" : "age:[27 TO 35]",
                "time_in_nanos" : 1905910,
                "breakdown" : {
                  "set_min_competitive_score_count" : 0,
                  "match_count" : 0,
                  "shallow_advance_count" : 0,
                  "set_min_competitive_score" : 0,
                  "next_doc" : 93290,
                  "match" : 0,
                  "next_doc_count" : 437,
                  "score_count" : 436,
                  "compute_max_score_count" : 0,
                  "compute_max_score" : 0,
                  "advance" : 4119,
                  "advance_count" : 2,
                  "score" : 87412,
                  "build_scorer_count" : 4,
                  "create_weight" : 4607,
                  "shallow_advance" : 0,
                  "create_weight_count" : 1,
                  "build_scorer" : 1716482
                }
              }
            ],
            "rewrite_time" : 10427,
            "collector" : [
              {
                "name" : "SimpleTopScoreDocCollector",
                "reason" : "search_top_hits",
                "time_in_nanos" : 447004
              }
            ]
          }
        ],
        "aggregations" : [ ]
      }
    ]
  }
}

日期范圍

由于這里我們的例子中沒有日期相關(guān)的數(shù)據(jù),所以我們再導(dǎo)入一份含有日期數(shù)據(jù)的文件到es中。即logs.jsonl
同樣通過命令行導(dǎo)入的方式:

 curl -H 'Content-Type: application/x-ndjson'  -s -XPOST ip:9200/_bulk --data-binary @logs.jsonl

因為這里導(dǎo)入的數(shù)據(jù)比較大,可能會報數(shù)據(jù)量過大的錯誤,此時需要修改es的內(nèi)存大小,因為我們在前面使用docker安裝es的時候,啟動的時候,設(shè)置了es的java虛擬機(jī)內(nèi)存使用大小為256m,所以這里我們需要將es集群關(guān)閉之后,重新啟動,如下所示:

docker stop ES01
docker rm ES01
docker run -d --restart=always -e ES_JAVA_OPTS="-Xms1g -Xmx1g" -p 9200:9200 -p 9300:9300 -v /data/es/config/es1.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /data/es/node1/data:/usr/share/elasticsearch/data -v /data/es/node1/plugins:/usr/share/elasticsearch/plugins --name ES01 elasticsearch:7.9.3

我們將這句-e ES_JAVA_OPTS="-Xms1g -Xmx1g"已經(jīng)修改為1g了,然后啟動,其他兩個節(jié)點(diǎn)同樣需要這樣的操作。
最后導(dǎo)入數(shù)據(jù)即可。

從圖中可知我們已經(jīng)導(dǎo)入成功了,
elasticsearch結(jié)構(gòu)化查詢(一)
這里我們開始學(xué)習(xí)range的查詢?nèi)掌谟梅?
在這里我們查詢?nèi)罩镜膗tc_time

GET logstash-2015.05.19/_search
{
  "query": {
    "range": {
      "utc_time": {
          "gte" : "2015-05-19T04:29:38.264Z",
          "lte" : "2015-05-30T04:29:38.264Z"
        }
    }
  }
}

返回結(jié)果:

{
  "took" : 4,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 4531,
      "relation" : "eq"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "logstash-2015.05.19",
        "_type" : "log",
        "_id" : "B-kR0IcB2l-Q2jxdeb9E",
        "_score" : 1.0,
        "_source" : {
          "@timestamp" : "2015-05-19T04:29:38.264Z",
          "ip" : "33.36.12.33",
          "extension" : "png",
          "response" : "503",
          "geo" : {
            "coordinates" : {
              "lat" : 33.45033444,
              "lon" : -88.59136861
            },
            "src" : "NG",
            "dest" : "PK",
            "srcdest" : "NG:PK"
          },
          "@tags" : [
            "success",
            "security"
          ],
          "utc_time" : "2015-05-19T04:29:38.264Z",
          "referer" : "http://twitter.com/success/kent-rominger",
          "agent" : "Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24",
          "clientip" : "33.36.12.33",
          "bytes" : 0,
          "host" : "media-for-the-masses.theacademyofperformingartsandscience.org",
          "request" : "/uploads/satoshi-furukawa.png",
          "url" : "https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/satoshi-furukawa.png",
          "@message" : "33.36.12.33 - - [2015-05-19T04:29:38.264Z] \"GET /uploads/satoshi-furukawa.png HTTP/1.1\" 503 0 \"-\" \"Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24\"",
          "spaces" : "this   is   a   thing    with lots of     spaces       wwwwoooooo",
          "xss" : """<script>console.log("xss")</script>""",
          "headings" : [
            "<h3>kimiya-yui</h5>",
            "http://www.slate.com/success/roman-romanenko"
          ],
          "links" : [
            "christopher-ferguson@www.slate.com",
            "http://www.slate.com/info/karol-bobko",
            "www.twitter.com"
          ],
          "relatedContent" : [
            {
              "url" : "http://www.laweekly.com/music/jim-white-amoeba-3-24-2412442",
              "og:type" : "article",
              "og:title" : "Jim White, Amoeba, 3/24",
              "og:description" : "Jim White Amoeba, March 24 Jim White&#039;s songs depend on a good deal of atmosphere, and no doubt when he plays tonight (Tuesday) at the Silent Movie Theat...",
              "og:url" : "http://www.laweekly.com/music/jim-white-amoeba-3-24-2412442",
              "article:published_time" : "2008-03-25T06:37:10-07:00",
              "article:modified_time" : "2014-11-27T10:15:27-08:00",
              "article:section" : "Music",
              "og:image" : "http://images1.laweekly.com/imager/jim-white-amoeba-3-24/u/original/2475386/img_6075.jpg",
              "og:image:height" : "360",
              "og:image:width" : "480",
              "og:site_name" : "LA Weekly",
              "twitter:title" : "Jim White, Amoeba, 3/24",
              "twitter:description" : "Jim White Amoeba, March 24 Jim White&#039;s songs depend on a good deal of atmosphere, and no doubt when he plays tonight (Tuesday) at the Silent Movie Theat...",
              "twitter:card" : "summary",
              "twitter:image" : "http://images1.laweekly.com/imager/jim-white-amoeba-3-24/u/original/2475386/img_6075.jpg",
              "twitter:site" : "@laweekly"
            },
            {
              "url" : "http://www.laweekly.com/restaurants/the-vegan-beer-festival-returns-this-may-with-a-swanky-new-location-5470861",
              "og:type" : "article",
              "og:title" : "The Vegan Beer Festival Returns This May With a Swanky New Location",
              "og:description" : "Now in its 6th year, the Vegan Beer Festival will take place this May with more animal-free food and drinks at a much improved location.",
              "og:url" : "http://www.laweekly.com/restaurants/the-vegan-beer-festival-returns-this-may-with-a-swanky-new-location-5470861",
              "article:published_time" : "2015-04-03T06:55:00-07:00",
              "article:modified_time" : "2015-04-03T06:55:04-07:00",
              "article:section" : "Restaurants",
              "og:image" : "http://images1.laweekly.com/imager/u/original/5470943/vegan-beer.jpg",
              "og:image:height" : "798",
              "og:image:width" : "1200",
              "og:site_name" : "LA Weekly",
              "twitter:title" : "The Vegan Beer Festival Returns This May With a Swanky New Location",
              "twitter:description" : "Now in its 6th year, the Vegan Beer Festival will take place this May with more animal-free food and drinks at a much improved location.",
              "twitter:card" : "summary",
              "twitter:image" : "http://images1.laweekly.com/imager/u/original/5470943/vegan-beer.jpg",
              "twitter:site" : "@laweekly"
            }
          ],
          "machine" : {
            "os" : "osx",
            "ram" : 18253611008
          },
          "@version" : "1"
        }
      },
      {
        "_index" : "logstash-2015.05.19",
        "_type" : "log",
        "_id" : "COkR0IcB2l-Q2jxdeb9E",
        "_score" : 1.0,
        "_source" : {
          "@timestamp" : "2015-05-19T09:36:57.086Z",
          "ip" : "116.116.183.113",
          "extension" : "jpg",
          "response" : "200",
          "geo" : {
            "coordinates" : {
              "lat" : 31.36399028,
              "lon" : -109.8831286
            },
            "src" : "US",
            "dest" : "SL",
            "srcdest" : "US:SL"
          },
          "@tags" : [
            "success",
            "info"
          ],
          "utc_time" : "2015-05-19T09:36:57.086Z",
          "referer" : "http://facebook.com/success/aleksei-gubarev",
          "agent" : "Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24",
          "clientip" : "116.116.183.113",
          "bytes" : 3715,
          "host" : "media-for-the-masses.theacademyofperformingartsandscience.org",
          "request" : "/uploads/vance-brand.jpg",
          "url" : "https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/vance-brand.jpg",
          "@message" : "116.116.183.113 - - [2015-05-19T09:36:57.086Z] \"GET /uploads/vance-brand.jpg HTTP/1.1\" 200 3715 \"-\" \"Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24\"",
          "spaces" : "this   is   a   thing    with lots of     spaces       wwwwoooooo",
          "xss" : """<script>console.log("xss")</script>""",
          "headings" : [
            "<h3>frank-de-winne</h5>",
            "http://www.slate.com/success/grigori-nelyubov"
          ],
          "links" : [
            "gennady-strekalov@www.slate.com",
            "http://nytimes.com/login/gemini-6a",
            "www.facebook.com"
          ],
          "relatedContent" : [
            {
              "url" : "http://www.laweekly.com/news/mistakes-were-made-2397282",
              "og:type" : "article",
              "og:title" : "Mistakes Were Made",
              "og:description" : "Dysfunctional business as usual at Pellicano trial When we last left the trial of Anthony Pellicano and four co-defendants, the proceedings had been thr...",
              "og:url" : "http://www.laweekly.com/news/mistakes-were-made-2397282",
              "article:published_time" : "2008-04-28T14:26:06-07:00",
              "article:modified_time" : "2014-11-26T18:18:39-08:00",
              "article:section" : "News",
              "og:site_name" : "LA Weekly",
              "twitter:title" : "Mistakes Were Made",
              "twitter:description" : "Dysfunctional business as usual at Pellicano trial When we last left the trial of Anthony Pellicano and four co-defendants, the proceedings had been thr...",
              "twitter:card" : "summary",
              "twitter:site" : "@laweekly"
            }
          ],
          "machine" : {
            "os" : "ios",
            "ram" : 20401094656
          },
          "@version" : "1"
        }
      },
      {
        "_index" : "logstash-2015.05.19",
        "_type" : "log",
        "_id" : "CekR0IcB2l-Q2jxdeb9E",
        "_score" : 1.0,
        "_source" : {
          "@timestamp" : "2015-05-19T06:19:55.080Z",
          "ip" : "22.50.26.143",
          "extension" : "jpg",
          "response" : "200",
          "geo" : {
            "coordinates" : {
              "lat" : 35.02397611,
              "lon" : -80.08127333
            },
            "src" : "IN",
            "dest" : "IN",
            "srcdest" : "IN:IN"
          },
          "@tags" : [
            "success",
            "info"
          ],
          "utc_time" : "2015-05-19T06:19:55.080Z",
          "referer" : "http://twitter.com/success/aleksandr-laveykin",
          "agent" : "Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110421 Firefox/6.0a1",
          "clientip" : "22.50.26.143",
          "bytes" : 8852,
          "host" : "media-for-the-masses.theacademyofperformingartsandscience.org",
          "request" : "/uploads/barbara-morgan.jpg",
          "url" : "https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/barbara-morgan.jpg",
          "@message" : "22.50.26.143 - - [2015-05-19T06:19:55.080Z] \"GET /uploads/barbara-morgan.jpg HTTP/1.1\" 200 8852 \"-\" \"Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110421 Firefox/6.0a1\"",
          "spaces" : "this   is   a   thing    with lots of     spaces       wwwwoooooo",
          "xss" : """<script>console.log("xss")</script>""",
          "headings" : [
            "<h3>james-p-bagian</h5>",
            "http://www.slate.com/success/judith-resnik"
          ],
          "links" : [
            "liu-boming@www.slate.com",
            "http://facebook.com/info/svetlana-savitskaya",
            "www.www.slate.com"
          ],
          "relatedContent" : [
            {
              "url" : "http://www.laweekly.com/music/the-whole-shootin-match-2404141",
              "og:type" : "article",
              "og:title" : "The whole shootin&#039; match",
              "og:description" : "So, I need to tell you about the show of the festival. My mind is blown, dude! I&#039;m sitting in this bar, reading my Archies comics, because I am desperat...",
              "og:url" : "http://www.laweekly.com/music/the-whole-shootin-match-2404141",
              "article:published_time" : "2007-03-16T12:03:12-07:00",
              "article:modified_time" : "2014-11-27T06:53:31-08:00",
              "article:section" : "Music",
              "og:site_name" : "LA Weekly",
              "twitter:title" : "The whole shootin&#039; match",
              "twitter:description" : "So, I need to tell you about the show of the festival. My mind is blown, dude! I&#039;m sitting in this bar, reading my Archies comics, because I am desperat...",
              "twitter:card" : "summary",
              "twitter:site" : "@laweekly"
            },
            {
              "url" : "http://www.laweekly.com/arts/weed-patch-2374272",
              "og:type" : "article",
              "og:title" : "Weed Patch",
              "og:description" : "O&#039;Briens pub on Main Street, in an area of Santa Monica I like to refer to as &quot;Venice Adjacent&quot; was host last night to a sweet band called Weed Patch, w...",
              "og:url" : "http://www.laweekly.com/arts/weed-patch-2374272",
              "article:published_time" : "2006-05-19T13:05:37-07:00",
              "article:modified_time" : "2014-11-25T18:06:55-08:00",
              "article:section" : "Arts",
              "og:image" : "http://images1.laweekly.com/imager/weed-patch/u/original/2444840/706878889_m_1.jpg",
              "og:image:height" : "151",
              "og:image:width" : "200",
              "og:site_name" : "LA Weekly",
              "twitter:title" : "Weed Patch",
              "twitter:description" : "O&#039;Briens pub on Main Street, in an area of Santa Monica I like to refer to as &quot;Venice Adjacent&quot; was host last night to a sweet band called Weed Patch, w...",
              "twitter:card" : "summary",
              "twitter:image" : "http://images1.laweekly.com/imager/weed-patch/u/original/2444840/706878889_m_1.jpg",
              "twitter:site" : "@laweekly"
            },
            {
              "url" : "http://www.laweekly.com/music/ernie-krivda-at-catalina-tonight-2410071",
              "og:type" : "article",
              "og:title" : "Ernie Krivda at Catalina Tonight",
              "og:description" : "By Brick Wahl Ya gotta love my buddy Dean, he&#039;s a nut. And inspired, brilliant, funny, knows everything and everybody Sicilian motormouth of a musician ...",
              "og:url" : "http://www.laweekly.com/music/ernie-krivda-at-catalina-tonight-2410071",
              "article:published_time" : "2007-11-14T13:35:04-08:00",
              "article:modified_time" : "2014-11-27T07:25:01-08:00",
              "article:section" : "Music",
              "og:site_name" : "LA Weekly",
              "twitter:title" : "Ernie Krivda at Catalina Tonight",
              "twitter:description" : "By Brick Wahl Ya gotta love my buddy Dean, he&#039;s a nut. And inspired, brilliant, funny, knows everything and everybody Sicilian motormouth of a musician ...",
              "twitter:card" : "summary",
              "twitter:site" : "@laweekly"
            },
            {
              "url" : "http://www.laweekly.com/music/prince-added-to-saturdays-coachella-line-up-2411813",
              "og:type" : "article",
              "og:title" : "Prince added to Saturday&#039;s Coachella Line-Up",
              "og:description" : "This just in: Prince has joined this year&#039;s line-up for the ninth COACHELLA VALLEY MUSIC &amp; ARTS FESTIVAL at the Empire Polo Field in Indio, CA (Friday, ...",
              "og:url" : "http://www.laweekly.com/music/prince-added-to-saturdays-coachella-line-up-2411813",
              "article:published_time" : "2008-04-09T11:25:30-07:00",
              "article:modified_time" : "2014-11-27T10:27:44-08:00",
              "article:section" : "Music",
              "og:site_name" : "LA Weekly",
              "twitter:title" : "Prince added to Saturday&#039;s Coachella Line-Up",
              "twitter:description" : "This just in: Prince has joined this year&#039;s line-up for the ninth COACHELLA VALLEY MUSIC &amp; ARTS FESTIVAL at the Empire Polo Field in Indio, CA (Friday, ...",
              "twitter:card" : "summary",
              "twitter:site" : "@laweekly"
            },
            {
              "url" : "http://www.laweekly.com/news/california-supreme-court-legalizes-gay-marriage-2391634",
              "og:type" : "article",
              "og:title" : "California Supreme Court Legalizes Gay Marriage!",
              "og:description" : "Citing the 60-year-old landmark case Perez v. Sharp, which struck down California&#039;s ban on interracial marriage, the California Supreme Court ruled toda...",
              "og:url" : "http://www.laweekly.com/news/california-supreme-court-legalizes-gay-marriage-2391634",
              "article:published_time" : "2008-05-15T10:18:54-07:00",
              "article:modified_time" : "2014-11-26T16:34:12-08:00",
              "article:section" : "News",
              "og:site_name" : "LA Weekly",
              "twitter:title" : "California Supreme Court Legalizes Gay Marriage!",
              "twitter:description" : "Citing the 60-year-old landmark case Perez v. Sharp, which struck down California&#039;s ban on interracial marriage, the California Supreme Court ruled toda...",
              "twitter:card" : "summary",
              "twitter:site" : "@laweekly"
            }
          ],
          "machine" : {
            "os" : "ios",
            "ram" : 10737418240
          },
          "@version" : "1"
        }
      },
      {
        "_index" : "logstash-2015.05.19",
        "_type" : "log",
        "_id" : "CukR0IcB2l-Q2jxdeb9E",
        "_score" : 1.0,
        "_source" : {
          "@timestamp" : "2015-05-19T06:49:46.347Z",
          "ip" : "192.109.235.88",
          "extension" : "jpg",
          "response" : "200",
          "geo" : {
            "coordinates" : {
              "lat" : 43.20925,
              "lon" : -112.3495861
            },
            "src" : "CN",
            "dest" : "CN",
            "srcdest" : "CN:CN"
          },
          "@tags" : [
            "success",
            "info"
          ],
          "utc_time" : "2015-05-19T06:49:46.347Z",
          "referer" : "http://www.slate.com/error/donald-deke-slayton",
          "agent" : "Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110421 Firefox/6.0a1",
          "clientip" : "192.109.235.88",
          "bytes" : 5450,
          "host" : "media-for-the-masses.theacademyofperformingartsandscience.org",
          "request" : "/uploads/aleksandr-laveykin.jpg",
          "url" : "https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/aleksandr-laveykin.jpg",
          "@message" : "192.109.235.88 - - [2015-05-19T06:49:46.347Z] \"GET /uploads/aleksandr-laveykin.jpg HTTP/1.1\" 200 5450 \"-\" \"Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110421 Firefox/6.0a1\"",
          "spaces" : "this   is   a   thing    with lots of     spaces       wwwwoooooo",
          "xss" : """<script>console.log("xss")</script>""",
          "headings" : [
            "<h3>zhang-xiaoguang</h5>",
            "http://facebook.com/success/maurizio-cheli"
          ],
          "links" : [
            "michael-s-hopkins@www.slate.com",
            "http://facebook.com/info/bruce-melnick",
            "www.www.slate.com"
          ],
          "relatedContent" : [
            {
              "url" : "http://www.laweekly.com/music/eddie-vedder-solo-at-the-wiltern-4-13-2408256",
              "og:type" : "article",
              "og:title" : "Eddie Vedder, Solo at the Wiltern, 4/13",
              "og:description" : "Photos by Timothy Norris. Text by Ryan Colditz Eddie Vedder is taking it solo. Pearl Jam has broken up and all that is left is Eddie Vedder. Just kiddin...",
              "og:url" : "http://www.laweekly.com/music/eddie-vedder-solo-at-the-wiltern-4-13-2408256",
              "article:published_time" : "2008-04-15T10:30:54-07:00",
              "article:modified_time" : "2014-11-27T09:43:47-08:00",
              "article:section" : "Music",
              "og:image" : "http://images1.laweekly.com/imager/eddie-vedder-solo-at-the-wiltern-4-13/u/original/2470767/eddieveddertn005.jpg",
              "og:image:height" : "723",
              "og:image:width" : "480",
              "og:site_name" : "LA Weekly",
              "twitter:title" : "Eddie Vedder, Solo at the Wiltern, 4/13",
              "twitter:description" : "Photos by Timothy Norris. Text by Ryan Colditz Eddie Vedder is taking it solo. Pearl Jam has broken up and all that is left is Eddie Vedder. Just kiddin...",
              "twitter:card" : "summary",
              "twitter:image" : "http://images1.laweekly.com/imager/eddie-vedder-solo-at-the-wiltern-4-13/u/original/2470767/eddieveddertn005.jpg",
              "twitter:site" : "@laweekly"
            },
            {
              "url" : "http://www.laweekly.com/arts/the-verdict-on-writers-all-bloody-nuts-phew-2371979",
              "og:type" : "article",
              "og:title" : "The Verdict on Writers: All Bloody Nuts (Phew)",
              "og:description" : "LA Weekly is the definitive source of information for news, music, movies, restaurants, reviews, and events in Los Angeles.",
              "og:url" : "http://www.laweekly.com/arts/the-verdict-on-writers-all-bloody-nuts-phew-2371979",
              "article:published_time" : "2006-11-28T13:11:40-08:00",
              "article:modified_time" : "2014-11-25T18:45:15-08:00",
              "article:section" : "Arts",
              "og:site_name" : "LA Weekly",
              "twitter:title" : "The Verdict on Writers: All Bloody Nuts (Phew)",
              "twitter:description" : "LA Weekly is the definitive source of information for news, music, movies, restaurants, reviews, and events in Los Angeles.",
              "twitter:card" : "summary",
              "twitter:site" : "@laweekly"
            },
            {
              "url" : "http://www.laweekly.com/news/san-fernando-valley-bloodbath-2391204",
              "og:type" : "article",
              "og:title" : "San Fernando Valley Bloodbath",
              "og:description" : "Mass Murder in Winnetka takes life of popular SWAT officer, a former Villaraigosa bodyguard An LAPD SWAT officer was shot to death and another was wound...",
              "og:url" : "http://www.laweekly.com/news/san-fernando-valley-bloodbath-2391204",
              "article:published_time" : "2008-02-07T18:32:44-08:00",
              "article:modified_time" : "2014-11-26T17:11:22-08:00",
              "article:section" : "News",
              "og:image" : "http://images1.laweekly.com/imager/san-fernando-valley-bloodbath/u/original/2421393/img_1591.jpg",
              "og:image:height" : "360",
              "og:image:width" : "480",
              "og:site_name" : "LA Weekly",
              "twitter:title" : "San Fernando Valley Bloodbath",
              "twitter:description" : "Mass Murder in Winnetka takes life of popular SWAT officer, a former Villaraigosa bodyguard An LAPD SWAT officer was shot to death and another was wound...",
              "twitter:card" : "summary",
              "twitter:image" : "http://images1.laweekly.com/imager/san-fernando-valley-bloodbath/u/original/2421393/img_1591.jpg",
              "twitter:site" : "@laweekly"
            }
          ],
          "machine" : {
            "os" : "win 8",
            "ram" : 10737418240
          },
          "@version" : "1"
        }
      },
      {
        "_index" : "logstash-2015.05.19",
        "_type" : "log",
        "_id" : "C-kR0IcB2l-Q2jxdeb9E",
        "_score" : 1.0,
        "_source" : {
          "@timestamp" : "2015-05-19T11:48:41.963Z",
          "ip" : "136.104.202.199",
          "extension" : "jpg",
          "response" : "200",
          "geo" : {
            "coordinates" : {
              "lat" : 47.32815583,
              "lon" : -122.2265092
            },
            "src" : "US",
            "dest" : "IN",
            "srcdest" : "US:IN"
          },
          "@tags" : [
            "success",
            "info"
          ],
          "utc_time" : "2015-05-19T11:48:41.963Z",
          "referer" : "http://facebook.com/success/dominic-gorie",
          "agent" : "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)",
          "clientip" : "136.104.202.199",
          "bytes" : 6410,
          "host" : "media-for-the-masses.theacademyofperformingartsandscience.org",
          "request" : "/uploads/carlos-i-noriega.jpg",
          "url" : "https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/carlos-i-noriega.jpg",
          "@message" : "136.104.202.199 - - [2015-05-19T11:48:41.963Z] \"GET /uploads/carlos-i-noriega.jpg HTTP/1.1\" 200 6410 \"-\" \"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)\"",
          "spaces" : "this   is   a   thing    with lots of     spaces       wwwwoooooo",
          "xss" : """<script>console.log("xss")</script>""",
          "headings" : [
            "<h3>garrett-reisman</h5>",
            "http://www.slate.com/success/yuri-glazkov"
          ],
          "links" : [
            "dick-scobee@twitter.com",
            "http://twitter.com/info/fernando-caldeiro",
            "www.facebook.com"
          ],
          "relatedContent" : [
            {
              "url" : "http://www.laweekly.com/music/marfa-film-fest-dispatch-world-premiere-of-heath-ledger-directed-music-video-2401553",
              "og:type" : "article",
              "og:title" : "Marfa Film Fest Dispatch: World Premiere of Heath Ledger-directed music video",
              "og:description" : "(photo by Randall Roberts) Today&#039;s a travel day for me, having just experienced the best little festival I&#039;ve ever attended, the first annual Marfa Film...",
              "og:url" : "http://www.laweekly.com/music/marfa-film-fest-dispatch-world-premiere-of-heath-ledger-directed-music-video-2401553",
              "article:published_time" : "2008-05-05T10:28:48-07:00",
              "article:modified_time" : "2014-11-27T07:00:15-08:00",
              "article:section" : "Music",
              "og:image" : "http://images1.laweekly.com/imager/marfa-film-fest-dispatch-world-premiere-o/u/original/2463872/img_2162.jpg",
              "og:image:height" : "768",
              "og:image:width" : "1024",
              "og:site_name" : "LA Weekly",
              "twitter:title" : "Marfa Film Fest Dispatch: World Premiere of Heath Ledger-directed music video",
              "twitter:description" : "(photo by Randall Roberts) Today&#039;s a travel day for me, having just experienced the best little festival I&#039;ve ever attended, the first annual Marfa Film...",
              "twitter:card" : "summary",
              "twitter:image" : "http://images1.laweekly.com/imager/marfa-film-fest-dispatch-world-premiere-o/u/original/2463872/img_2162.jpg",
              "twitter:site" : "@laweekly"
            }
          ],
          "machine" : {
            "os" : "win 8",
            "ram" : 6442450944
          },
          "@version" : "1"
        }
      },
      {
        "_index" : "logstash-2015.05.19",
        "_type" : "log",
        "_id" : "DOkR0IcB2l-Q2jxdeb9E",
        "_score" : 1.0,
        "_source" : {
          "@timestamp" : "2015-05-19T12:21:09.414Z",
          "ip" : "187.54.191.70",
          "extension" : "jpg",
          "response" : "200",
          "geo" : {
            "coordinates" : {
              "lat" : 34.91496778,
              "lon" : -88.60348361
            },
            "src" : "IN",
            "dest" : "IR",
            "srcdest" : "IN:IR"
          },
          "@tags" : [
            "success",
            "info"
          ],
          "utc_time" : "2015-05-19T12:21:09.414Z",
          "referer" : "http://twitter.com/success/james-dutton",
          "agent" : "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)",
          "clientip" : "187.54.191.70",
          "bytes" : 3132,
          "host" : "media-for-the-masses.theacademyofperformingartsandscience.org",
          "request" : "/uploads/sandra-magnus.jpg",
          "url" : "https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/sandra-magnus.jpg",
          "@message" : "187.54.191.70 - - [2015-05-19T12:21:09.414Z] \"GET /uploads/sandra-magnus.jpg HTTP/1.1\" 200 3132 \"-\" \"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)\"",
          "spaces" : "this   is   a   thing    with lots of     spaces       wwwwoooooo",
          "xss" : """<script>console.log("xss")</script>""",
          "headings" : [
            "<h3>frank-de-winne</h5>",
            "http://facebook.com/success/michael-coats"
          ],
          "links" : [
            "vyacheslav-zudov@twitter.com",
            "http://www.slate.com/info/roman-romanenko",
            "www.www.slate.com"
          ],
          "relatedContent" : [
            {
              "url" : "http://www.laweekly.com/arts/khaan-the-greatest-syllable-ever-told-2370737",
              "og:type" : "article",
              "og:title" : "KHAAN! The Greatest Syllable Ever Told",
              "og:description" : "It&#039;s funny the first time Shatner yells it out. It is, after all, the named-turned-curse heard throughout a galaxy. That one word - that one syllable - ...",
              "og:url" : "http://www.laweekly.com/arts/khaan-the-greatest-syllable-ever-told-2370737",
              "article:published_time" : "2008-05-29T13:19:29-07:00",
              "article:modified_time" : "2014-12-05T00:59:06-08:00",
              "article:section" : "Arts",
              "og:image" : "http://images1.laweekly.com/imager/khaan-the-greatest-syllable-ever-told/u/original/2433500/khan_c1.jpg",
              "og:image:height" : "288",
              "og:image:width" : "432",
              "og:site_name" : "LA Weekly",
              "twitter:title" : "KHAAN! The Greatest Syllable Ever Told",
              "twitter:description" : "It&#039;s funny the first time Shatner yells it out. It is, after all, the named-turned-curse heard throughout a galaxy. That one word - that one syllable - ...",
              "twitter:card" : "summary",
              "twitter:image" : "http://images1.laweekly.com/imager/khaan-the-greatest-syllable-ever-told/u/original/2433500/khan_c1.jpg",
              "twitter:site" : "@laweekly"
            },
            {
              "url" : "http://www.laweekly.com/music/mick-jones-carbon-silicon-troubadour-12-3-2406690",
              "og:type" : "article",
              "og:title" : "Mick Jones&#039; Carbon/Silicon, Troubadour, 12/3",
              "og:description" : "How long has it been since Mick Jones played L.A.? He said on stage he hadn&#039;t been here in 12 years, which would put us back into Big Audio Dynamite ter...",
              "og:url" : "http://www.laweekly.com/music/mick-jones-carbon-silicon-troubadour-12-3-2406690",
              "article:published_time" : "2007-12-04T11:16:05-08:00",
              "article:modified_time" : "2014-11-27T08:46:09-08:00",
              "article:section" : "Music",
              "og:image" : "http://images1.laweekly.com/imager/mick-jones-carbon-silicon-troubadour-12/u/original/2469021/img_1768.jpg",
              "og:image:height" : "640",
              "og:image:width" : "480",
              "og:site_name" : "LA Weekly",
              "twitter:title" : "Mick Jones&#039; Carbon/Silicon, Troubadour, 12/3",
              "twitter:description" : "How long has it been since Mick Jones played L.A.? He said on stage he hadn&#039;t been here in 12 years, which would put us back into Big Audio Dynamite ter...",
              "twitter:card" : "summary",
              "twitter:image" : "http://images1.laweekly.com/imager/mick-jones-carbon-silicon-troubadour-12/u/original/2469021/img_1768.jpg",
              "twitter:site" : "@laweekly"
            }
          ],
          "machine" : {
            "os" : "win 8",
            "ram" : 11811160064
          },
          "@version" : "1"
        }
      },
      {
        "_index" : "logstash-2015.05.19",
        "_type" : "log",
        "_id" : "DekR0IcB2l-Q2jxdeb9E",
        "_score" : 1.0,
        "_source" : {
          "@timestamp" : "2015-05-19T12:28:36.273Z",
          "ip" : "186.123.242.20",
          "extension" : "css",
          "response" : "200",
          "geo" : {
            "coordinates" : {
              "lat" : 35.949925,
              "lon" : -96.77305278
            },
            "src" : "IT",
            "dest" : "TN",
            "srcdest" : "IT:TN"
          },
          "@tags" : [
            "success",
            "info"
          ],
          "utc_time" : "2015-05-19T12:28:36.273Z",
          "referer" : "http://www.slate.com/success/john-david-f-bartoe",
          "agent" : "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)",
          "clientip" : "186.123.242.20",
          "bytes" : 5052,
          "host" : "cdn.theacademyofperformingartsandscience.org",
          "request" : "/styles/ads.css",
          "url" : "https://cdn.theacademyofperformingartsandscience.org/styles/ads.css",
          "@message" : "186.123.242.20 - - [2015-05-19T12:28:36.273Z] \"GET /styles/ads.css HTTP/1.1\" 200 5052 \"-\" \"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)\"",
          "spaces" : "this   is   a   thing    with lots of     spaces       wwwwoooooo",
          "xss" : """<script>console.log("xss")</script>""",
          "headings" : [
            "<h3>jon-mcbride</h5>",
            "http://twitter.com/success/william-pailes"
          ],
          "links" : [
            "sergei-ryazanski@www.slate.com",
            "http://twitter.com/info/donald-thomas",
            "www.twitter.com"
          ],
          "relatedContent" : [
            {
              "url" : "http://www.laweekly.com/arts/bald-and-er-bald-2373338",
              "og:type" : "article",
              "og:title" : "Bald and Er, Bald",
              "og:description" : "Are we supposed to comment on this? I&#039;m speechless. Kudos to The Post for avoiding the now cliched, &quot;Britney Shears.&quot; And calling her &quot;a buzz kill&quot; was ...",
              "og:url" : "http://www.laweekly.com/arts/bald-and-er-bald-2373338",
              "article:published_time" : "2007-02-21T17:02:02-08:00",
              "article:modified_time" : "2014-11-25T20:18:42-08:00",
              "article:section" : "Arts",
              "og:image" : "http://IMAGES1.laweekly.com/imager/bald-and-er-bald/u/original/2441881/2007_02_britneybald.jpg",
              "og:image:height" : "330",
              "og:image:width" : "517",
              "og:site_name" : "LA Weekly",
              "twitter:title" : "Bald and Er, Bald",
              "twitter:description" : "Are we supposed to comment on this? I&#039;m speechless. Kudos to The Post for avoiding the now cliched, &quot;Britney Shears.&quot; And calling her &quot;a buzz kill&quot; was ...",
              "twitter:card" : "summary",
              "twitter:image" : "http://IMAGES1.laweekly.com/imager/bald-and-er-bald/u/original/2441881/2007_02_britneybald.jpg",
              "twitter:site" : "@laweekly"
            }
          ],
          "machine" : {
            "os" : "win 8",
            "ram" : 11811160064
          },
          "@version" : "1"
        }
      },
      {
        "_index" : "logstash-2015.05.19",
        "_type" : "log",
        "_id" : "DukR0IcB2l-Q2jxdeb9E",
        "_score" : 1.0,
        "_source" : {
          "@timestamp" : "2015-05-19T12:41:54.861Z",
          "ip" : "162.97.220.195",
          "extension" : "jpg",
          "response" : "200",
          "geo" : {
            "coordinates" : {
              "lat" : 34.39833889,
              "lon" : -96.14805972
            },
            "src" : "BI",
            "dest" : "IN",
            "srcdest" : "BI:IN"
          },
          "@tags" : [
            "success",
            "info"
          ],
          "utc_time" : "2015-05-19T12:41:54.861Z",
          "referer" : "http://twitter.com/success/garrett-reisman",
          "agent" : "Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24",
          "clientip" : "162.97.220.195",
          "bytes" : 4797,
          "host" : "media-for-the-masses.theacademyofperformingartsandscience.org",
          "request" : "/uploads/sidney-gutierrez.jpg",
          "url" : "https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/sidney-gutierrez.jpg",
          "@message" : "162.97.220.195 - - [2015-05-19T12:41:54.861Z] \"GET /uploads/sidney-gutierrez.jpg HTTP/1.1\" 200 4797 \"-\" \"Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24\"",
          "spaces" : "this   is   a   thing    with lots of     spaces       wwwwoooooo",
          "xss" : """<script>console.log("xss")</script>""",
          "headings" : [
            "<h3>donald-thomas</h5>",
            "http://facebook.com/warning/anton-shkaplerov"
          ],
          "links" : [
            "james-wetherbee@twitter.com",
            "http://twitter.com/security/william-frederick-fisher",
            "www.facebook.com"
          ],
          "relatedContent" : [
            {
              "url" : "http://www.laweekly.com/arts/takin-it-higher-2372017",
              "og:type" : "article",
              "og:title" : "Takin&#039; it Higher",
              "og:description" : "So the DVF party on Sat was a fun lil fete (see Steffie&#039;s post below) but heck, I haven&#039;t even told ya about my Grammy week craziness&hellip;. Well you ...",
              "og:url" : "http://www.laweekly.com/arts/takin-it-higher-2372017",
              "article:published_time" : "2006-02-13T19:02:50-08:00",
              "article:modified_time" : "2014-11-25T18:10:27-08:00",
              "article:section" : "Arts",
              "og:image" : "http://images1.laweekly.com/imager/takin-it-higher/u/original/2437749/img_0962.jpg",
              "og:image:height" : "225",
              "og:image:width" : "300",
              "og:site_name" : "LA Weekly",
              "twitter:title" : "Takin&#039; it Higher",
              "twitter:description" : "So the DVF party on Sat was a fun lil fete (see Steffie&#039;s post below) but heck, I haven&#039;t even told ya about my Grammy week craziness&hellip;. Well you ...",
              "twitter:card" : "summary",
              "twitter:image" : "http://images1.laweekly.com/imager/takin-it-higher/u/original/2437749/img_0962.jpg",
              "twitter:site" : "@laweekly"
            },
            {
              "url" : "http://www.laweekly.com/music/pause-and-rewind-the-show-2408308",
              "og:type" : "article",
              "og:title" : "Pause and Rewind: The Show",
              "og:description" : "I remember watching The Show for the first and only time when I was a freshman in high school. I wasn&#039;t very impressed. This was 1995, Biggie was alive,...",
              "og:url" : "http://www.laweekly.com/music/pause-and-rewind-the-show-2408308",
              "article:published_time" : "2008-01-25T00:31:38-08:00",
              "article:modified_time" : "2014-11-27T08:19:41-08:00",
              "article:section" : "Music",
              "og:site_name" : "LA Weekly",
              "twitter:title" : "Pause and Rewind: The Show",
              "twitter:description" : "I remember watching The Show for the first and only time when I was a freshman in high school. I wasn&#039;t very impressed. This was 1995, Biggie was alive,...",
              "twitter:card" : "summary",
              "twitter:site" : "@laweekly"
            }
          ],
          "machine" : {
            "os" : "ios",
            "ram" : 21474836480
          },
          "@version" : "1"
        }
      },
      {
        "_index" : "logstash-2015.05.19",
        "_type" : "log",
        "_id" : "D-kR0IcB2l-Q2jxdeb9E",
        "_score" : 1.0,
        "_source" : {
          "@timestamp" : "2015-05-19T07:36:17.353Z",
          "ip" : "169.232.223.103",
          "extension" : "gif",
          "response" : "200",
          "geo" : {
            "coordinates" : {
              "lat" : 36.78833556,
              "lon" : -78.50155361
            },
            "src" : "BR",
            "dest" : "IN",
            "srcdest" : "BR:IN"
          },
          "@tags" : [
            "success",
            "security"
          ],
          "utc_time" : "2015-05-19T07:36:17.353Z",
          "referer" : "http://www.slate.com/error/sidney-gutierrez",
          "agent" : "Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24",
          "clientip" : "169.232.223.103",
          "bytes" : 847,
          "host" : "motion-media.theacademyofperformingartsandscience.org",
          "request" : "/canhaz/carl-walz.gif",
          "url" : "https://motion-media.theacademyofperformingartsandscience.org/canhaz/carl-walz.gif",
          "@message" : "169.232.223.103 - - [2015-05-19T07:36:17.353Z] \"GET /canhaz/carl-walz.gif HTTP/1.1\" 200 847 \"-\" \"Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24\"",
          "spaces" : "this   is   a   thing    with lots of     spaces       wwwwoooooo",
          "xss" : """<script>console.log("xss")</script>""",
          "headings" : [
            "<h3>lee-morin</h5>",
            "http://www.slate.com/success/jing-haipeng"
          ],
          "links" : [
            "michael-baker@www.slate.com",
            "http://www.slate.com/info/scott-kelly",
            "www.www.slate.com"
          ],
          "relatedContent" : [
            {
              "url" : "http://www.laweekly.com/arts/touched-by-a-tranny-2374416",
              "og:type" : "article",
              "og:title" : "Touched By A Tranny",
              "og:description" : "We&#039;ve been calling plus-size punny (lad)y Jackie Beat our &quot;favorite drag queen&quot; for years (and that&#039;s saying something... we know a lot of crossdressers...",
              "og:url" : "http://www.laweekly.com/arts/touched-by-a-tranny-2374416",
              "article:published_time" : "2008-05-15T15:10:44-07:00",
              "article:modified_time" : "2014-11-25T18:13:13-08:00",
              "article:section" : "Arts",
              "og:site_name" : "LA Weekly",
              "twitter:title" : "Touched By A Tranny",
              "twitter:description" : "We&#039;ve been calling plus-size punny (lad)y Jackie Beat our &quot;favorite drag queen&quot; for years (and that&#039;s saying something... we know a lot of crossdressers...",
              "twitter:card" : "summary",
              "twitter:site" : "@laweekly"
            },
            {
              "url" : "http://www.laweekly.com/arts/bravo-bebe-2371443",
              "og:type" : "article",
              "og:title" : "Bravo Bebe!",
              "og:description" : "LA Weekly is the definitive source of information for news, music, movies, restaurants, reviews, and events in Los Angeles.",
              "og:url" : "http://www.laweekly.com/arts/bravo-bebe-2371443",
              "article:published_time" : "2006-10-19T12:10:54-07:00",
              "article:modified_time" : "2014-11-25T17:43:53-08:00",
              "article:section" : "Arts",
              "og:site_name" : "LA Weekly",
              "twitter:title" : "Bravo Bebe!",
              "twitter:description" : "LA Weekly is the definitive source of information for news, music, movies, restaurants, reviews, and events in Los Angeles.",
              "twitter:card" : "summary",
              "twitter:site" : "@laweekly"
            }
          ],
          "machine" : {
            "os" : "osx",
            "ram" : 18253611008
          },
          "@version" : "1"
        }
      },
      {
        "_index" : "logstash-2015.05.19",
        "_type" : "log",
        "_id" : "EOkR0IcB2l-Q2jxdeb9E",
        "_score" : 1.0,
        "_source" : {
          "@timestamp" : "2015-05-19T09:08:14.761Z",
          "ip" : "152.36.85.152",
          "extension" : "jpg",
          "response" : "200",
          "geo" : {
            "coordinates" : {
              "lat" : 42.38214444,
              "lon" : -77.6821125
            },
            "src" : "IR",
            "dest" : "MX",
            "srcdest" : "IR:MX"
          },
          "@tags" : [
            "success",
            "info"
          ],
          "utc_time" : "2015-05-19T09:08:14.761Z",
          "referer" : "http://twitter.com/success/richard-linnehan",
          "agent" : "Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110421 Firefox/6.0a1",
          "clientip" : "152.36.85.152",
          "bytes" : 6895,
          "host" : "media-for-the-masses.theacademyofperformingartsandscience.org",
          "request" : "/uploads/kenneth-ham.jpg",
          "url" : "https://media-for-the-masses.theacademyofperformingartsandscience.org/uploads/kenneth-ham.jpg",
          "@message" : "152.36.85.152 - - [2015-05-19T09:08:14.761Z] \"GET /uploads/kenneth-ham.jpg HTTP/1.1\" 200 6895 \"-\" \"Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110421 Firefox/6.0a1\"",
          "spaces" : "this   is   a   thing    with lots of     spaces       wwwwoooooo",
          "xss" : """<script>console.log("xss")</script>""",
          "headings" : [
            "<h3>john-casper</h5>",
            "http://www.slate.com/success/ronald-sega"
          ],
          "links" : [
            "georgi-shonin@twitter.com",
            "http://facebook.com/security/jean-fran-ois-clervoy",
            "www.www.slate.com"
          ],
          "relatedContent" : [
            {
              "url" : "http://www.laweekly.com/music/mex-emo-news-coverage-explodes-2401636",
              "og:type" : "article",
              "og:title" : "Mex-Emo News Coverage Explodes",
              "og:description" : "L.A. Weekly blogger and former staff writer Daniel Hernandez uncovered a wild story about attacks on &quot;emo&quot; youths in Mexico City on LA Daily and his own...",
              "og:url" : "http://www.laweekly.com/music/mex-emo-news-coverage-explodes-2401636",
              "article:published_time" : "2008-03-28T11:10:05-07:00",
              "article:modified_time" : "2014-11-27T07:00:43-08:00",
              "article:section" : "Music",
              "og:site_name" : "LA Weekly",
              "twitter:title" : "Mex-Emo News Coverage Explodes",
              "twitter:description" : "L.A. Weekly blogger and former staff writer Daniel Hernandez uncovered a wild story about attacks on &quot;emo&quot; youths in Mexico City on LA Daily and his own...",
              "twitter:card" : "summary",
              "twitter:site" : "@laweekly"
            },
            {
              "url" : "http://www.laweekly.com/arts/the-year-of-the-dog-2371873",
              "og:type" : "article",
              "og:title" : "The Year of the Dog",
              "og:description" : "LA Weekly is the definitive source of information for news, music, movies, restaurants, reviews, and events in Los Angeles.",
              "og:url" : "http://www.laweekly.com/arts/the-year-of-the-dog-2371873",
              "article:published_time" : "2006-05-11T16:05:28-07:00",
              "article:modified_time" : "2014-11-25T18:42:53-08:00",
              "article:section" : "Arts",
              "og:site_name" : "LA Weekly",
              "twitter:title" : "The Year of the Dog",
              "twitter:description" : "LA Weekly is the definitive source of information for news, music, movies, restaurants, reviews, and events in Los Angeles.",
              "twitter:card" : "summary",
              "twitter:site" : "@laweekly"
            },
            {
              "url" : "http://www.laweekly.com/music/raiders-of-the-lost-art-2405123",
              "og:type" : "article",
              "og:title" : "Raiders of the Lost Art",
              "og:description" : "Sometime after 50 arrived, the art of the narrative wandered into a blizzard of coke raps, artificial hood mythologizing and pandering simplicity. Compl...",
              "og:url" : "http://www.laweekly.com/music/raiders-of-the-lost-art-2405123",
              "article:published_time" : "2007-11-29T08:09:55-08:00",
              "article:modified_time" : "2014-11-27T07:28:26-08:00",
              "article:section" : "Music",
              "og:image" : "http://IMAGES1.laweekly.com/imager/raiders-of-the-lost-art/u/original/2467283/b0000013gt01_sclzzzzzzz_.jpg",
              "og:image:height" : "455",
              "og:image:width" : "455",
              "og:site_name" : "LA Weekly",
              "twitter:title" : "Raiders of the Lost Art",
              "twitter:description" : "Sometime after 50 arrived, the art of the narrative wandered into a blizzard of coke raps, artificial hood mythologizing and pandering simplicity. Compl...",
              "twitter:card" : "summary",
              "twitter:image" : "http://IMAGES1.laweekly.com/imager/raiders-of-the-lost-art/u/original/2467283/b0000013gt01_sclzzzzzzz_.jpg",
              "twitter:site" : "@laweekly"
            }
          ],
          "machine" : {
            "os" : "ios",
            "ram" : 21474836480
          },
          "@version" : "1"
        }
      }
    ]
  }
}

準(zhǔn)確的輸出了日期2015-05-19T04:29:38.264Z與2015-05-30T04:29:38.264Z之間的數(shù)據(jù)。

小結(jié)

關(guān)于range的查詢基本就這么多,還有部分關(guān)于字符串的,過于簡單就不做詳細(xì)的敘述,因為字符串的查詢是直接利用的字典序查詢,不如是用其他方式直接查詢字符串。還有關(guān)于ip的范圍查詢,但是實在聚合查詢中體現(xiàn)的,在range中好像并沒法使用。

Exists查詢

exists查詢的主要意思是字段是否存在值,如果不存在值,則不會被查詢出來,如果有值,則會被查詢出來,null的情況下也不會被查詢出來。
這里我就直接查詢了,因為數(shù)據(jù)量比較大,所以只展示用法,數(shù)據(jù)是否為null等就算了,嘿嘿

GET bank/_search
{
  "query": {
    "exists": {
      "field": "firstname"
    }
  },
      "profile": "true"
}

返回結(jié)果:

{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 1000,
      "relation" : "eq"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "6",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 6,
          "balance" : 5686,
          "firstname" : "Hattie",
          "lastname" : "Bond",
          "age" : 36,
          "gender" : "M",
          "address" : "671 Bristol Street",
          "employer" : "Netagy",
          "email" : "hattiebond@netagy.com",
          "city" : "Dante",
          "state" : "TN"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "13",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 13,
          "balance" : 32838,
          "firstname" : "Nanette",
          "lastname" : "Bates",
          "age" : 28,
          "gender" : "F",
          "address" : "789 Madison Street",
          "employer" : "Quility",
          "email" : "nanettebates@quility.com",
          "city" : "Nogal",
          "state" : "VA"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "18",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 18,
          "balance" : 4180,
          "firstname" : "Dale",
          "lastname" : "Adams",
          "age" : 33,
          "gender" : "M",
          "address" : "467 Hutchinson Court",
          "employer" : "Boink",
          "email" : "daleadams@boink.com",
          "city" : "Orick",
          "state" : "MD"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "20",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 20,
          "balance" : 16418,
          "firstname" : "Elinor",
          "lastname" : "Ratliff",
          "age" : 36,
          "gender" : "M",
          "address" : "282 Kings Place",
          "employer" : "Scentric",
          "email" : "elinorratliff@scentric.com",
          "city" : "Ribera",
          "state" : "WA"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "25",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 25,
          "balance" : 40540,
          "firstname" : "Virginia",
          "lastname" : "Ayala",
          "age" : 39,
          "gender" : "F",
          "address" : "171 Putnam Avenue",
          "employer" : "Filodyne",
          "email" : "virginiaayala@filodyne.com",
          "city" : "Nicholson",
          "state" : "PA"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "32",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 32,
          "balance" : 48086,
          "firstname" : "Dillard",
          "lastname" : "Mcpherson",
          "age" : 34,
          "gender" : "F",
          "address" : "702 Quentin Street",
          "employer" : "Quailcom",
          "email" : "dillardmcpherson@quailcom.com",
          "city" : "Veguita",
          "state" : "IN"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "37",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 37,
          "balance" : 18612,
          "firstname" : "Mcgee",
          "lastname" : "Mooney",
          "age" : 39,
          "gender" : "M",
          "address" : "826 Fillmore Place",
          "employer" : "Reversus",
          "email" : "mcgeemooney@reversus.com",
          "city" : "Tooleville",
          "state" : "OK"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "44",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 44,
          "balance" : 34487,
          "firstname" : "Aurelia",
          "lastname" : "Harding",
          "age" : 37,
          "gender" : "M",
          "address" : "502 Baycliff Terrace",
          "employer" : "Orbalix",
          "email" : "aureliaharding@orbalix.com",
          "city" : "Yardville",
          "state" : "DE"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "49",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 49,
          "balance" : 29104,
          "firstname" : "Fulton",
          "lastname" : "Holt",
          "age" : 23,
          "gender" : "F",
          "address" : "451 Humboldt Street",
          "employer" : "Anocha",
          "email" : "fultonholt@anocha.com",
          "city" : "Sunriver",
          "state" : "RI"
        }
      },
      {
        "_index" : "bank",
        "_type" : "account",
        "_id" : "51",
        "_score" : 1.0,
        "_source" : {
          "account_number" : 51,
          "balance" : 14097,
          "firstname" : "Burton",
          "lastname" : "Meyers",
          "age" : 31,
          "gender" : "F",
          "address" : "334 River Street",
          "employer" : "Bezal",
          "email" : "burtonmeyers@bezal.com",
          "city" : "Jacksonburg",
          "state" : "MO"
        }
      }
    ]
  },
  "profile" : {
    "shards" : [
      {
        "id" : "[pgvIy_S0QwiNETOTSEWFtw][bank][0]",
        "searches" : [
          {
            "query" : [
              {
                "type" : "ConstantScoreQuery",
                "description" : "ConstantScore(NormsFieldExistsQuery [field=firstname])",
                "time_in_nanos" : 274491,
                "breakdown" : {
                  "set_min_competitive_score_count" : 0,
                  "match_count" : 0,
                  "shallow_advance_count" : 0,
                  "set_min_competitive_score" : 0,
                  "next_doc" : 82208,
                  "match" : 0,
                  "next_doc_count" : 1001,
                  "score_count" : 1000,
                  "compute_max_score_count" : 0,
                  "compute_max_score" : 0,
                  "advance" : 2270,
                  "advance_count" : 2,
                  "score" : 27152,
                  "build_scorer_count" : 4,
                  "create_weight" : 32473,
                  "shallow_advance" : 0,
                  "create_weight_count" : 1,
                  "build_scorer" : 130388
                },
                "children" : [
                  {
                    "type" : "NormsFieldExistsQuery",
                    "description" : "NormsFieldExistsQuery [field=firstname]",
                    "time_in_nanos" : 65654,
                    "breakdown" : {
                      "set_min_competitive_score_count" : 0,
                      "match_count" : 0,
                      "shallow_advance_count" : 0,
                      "set_min_competitive_score" : 0,
                      "next_doc" : 27263,
                      "match" : 0,
                      "next_doc_count" : 1001,
                      "score_count" : 0,
                      "compute_max_score_count" : 0,
                      "compute_max_score" : 0,
                      "advance" : 1265,
                      "advance_count" : 2,
                      "score" : 0,
                      "build_scorer_count" : 4,
                      "create_weight" : 6826,
                      "shallow_advance" : 0,
                      "create_weight_count" : 1,
                      "build_scorer" : 30300
                    }
                  }
                ]
              }
            ],
            "rewrite_time" : 2103,
            "collector" : [
              {
                "name" : "SimpleTopScoreDocCollector",
                "reason" : "search_top_hits",
                "time_in_nanos" : 101852
              }
            ]
          }
        ],
        "aggregations" : [ ]
      }
    ]
  }
}

總結(jié)

結(jié)構(gòu)化查詢的第一部分基本就這么多,后面還會學(xué)習(xí)第二部分的,關(guān)于模糊查詢方面的。文章來源地址http://www.zghlxwxcb.cn/news/detail-453247.html

到了這里,關(guān)于elasticsearch結(jié)構(gòu)化查詢(一)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點(diǎn)擊違法舉報進(jìn)行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • MySql003——SQL(結(jié)構(gòu)化查詢語言)基礎(chǔ)知識

    DB:數(shù)據(jù)庫(Database) 即存儲數(shù)據(jù)的“倉庫”,其本質(zhì)是一個 文件系統(tǒng) 。它保存了一系列有組織的數(shù)據(jù)。 DBMS:數(shù)據(jù)庫管理系統(tǒng)(Database Management System) 是一種操縱和管理數(shù)據(jù)庫的 大型軟件 (例如我們前面下載的MySQL軟件),用于建立、使用和維護(hù)數(shù)據(jù)庫,對數(shù)據(jù)庫進(jìn)行統(tǒng)一

    2024年02月15日
    瀏覽(70)
  • 三、計算機(jī)理論-關(guān)系數(shù)據(jù)庫-結(jié)構(gòu)化查詢語言SQL

    SQL 概述 是一種介于關(guān)系代數(shù)與關(guān)系演算之間的語言,現(xiàn)成為關(guān)系數(shù)據(jù)庫的標(biāo)準(zhǔn)語言 特點(diǎn):綜合統(tǒng)一、高度非過程化、面向集合的操作方式、以同一種語法結(jié)構(gòu)提供兩種使用方式(直接使用或者嵌入高級語言使用)、語言簡潔,易學(xué)易用。 四大功能如下: SQL功能 動詞 數(shù)據(jù)查

    2024年01月24日
    瀏覽(50)
  • 數(shù)據(jù)管理系統(tǒng)-week6-結(jié)構(gòu)化查詢語言(SQL)簡介

    Structured Query Language(SQL),本節(jié)課內(nèi)容比較輕松,主要介紹了SQL的結(jié)構(gòu)化查詢語言,簡單介紹的一些SQL的特性,功能,格式化等內(nèi)容 ?由IBM在20世紀(jì)70年代中期開發(fā)和實施 ?最初稱為SEQUEL(結(jié)構(gòu)化英語查詢語言) ?首次實施:IBM的SYSTEM R(DB/2,UDB)、Oracle SQL ?1986年的第一個

    2024年01月16日
    瀏覽(32)
  • 使用阿里云試用Elasticsearch學(xué)習(xí):2.1 深入搜索——結(jié)構(gòu)化搜索

    結(jié)構(gòu)化搜索(Structured search) 是指有關(guān)探詢那些具有內(nèi)在結(jié)構(gòu)數(shù)據(jù)的過程。比如日期、時間和數(shù)字都是結(jié)構(gòu)化的:它們有精確的格式,我們可以對這些格式進(jìn)行邏輯操作。比較常見的操作包括比較數(shù)字或時間的范圍,或判定兩個值的大小。 文本也可以是結(jié)構(gòu)化的。如彩色筆可

    2024年04月11日
    瀏覽(23)
  • 結(jié)構(gòu)化數(shù)據(jù)、非結(jié)構(gòu)化數(shù)據(jù)、半結(jié)構(gòu)化數(shù)據(jù)

    結(jié)構(gòu)化數(shù)據(jù)、非結(jié)構(gòu)化數(shù)據(jù)、半結(jié)構(gòu)化數(shù)據(jù)

    結(jié)構(gòu)化的數(shù)據(jù)一般是指可以使用關(guān)系型數(shù)據(jù)庫表示和存儲,可以用二維表來邏輯表達(dá)實現(xiàn)的數(shù)據(jù)。例如:需要多少個屬性,每個屬性什么類型,每個屬性的取值范圍等等,類似下圖所示, 提前定義好了一個二維矩陣的元數(shù)據(jù) ,包含有列名稱、列的類型、列的約束等: ? 可見

    2024年02月09日
    瀏覽(93)
  • 第五章 結(jié)構(gòu)化設(shè)計

    第五章 結(jié)構(gòu)化設(shè)計

    一種軟件開發(fā)活動,定義實現(xiàn)需求規(guī)約所需的軟件結(jié)構(gòu)。 結(jié)構(gòu)化設(shè)計分為: (1)總體設(shè)計:確定系統(tǒng)的整體模塊結(jié)構(gòu),即系統(tǒng)實現(xiàn)所需要的軟件模塊以及這些模塊之間的調(diào)用關(guān)系。 (2)詳細(xì)設(shè)計:詳細(xì)描述模塊。 體系結(jié)構(gòu)設(shè)計(MSD) 接口設(shè)計 數(shù)據(jù)設(shè)計 實現(xiàn)軟件設(shè)計的目標(biāo)對結(jié)

    2024年02月08日
    瀏覽(28)
  • 【numpy基礎(chǔ)】--結(jié)構(gòu)化

    目前為止,介紹的 numpy 數(shù)組基本都是關(guān)于數(shù)值的,其實, numpy 本身就是一個用于數(shù)值計算的基礎(chǔ)庫。 不過,除了數(shù)值計算之外, numpy 也能夠支持 結(jié)構(gòu)化數(shù)組 。 numpy 的數(shù)組為了提高計算性能,要求數(shù)組的數(shù)據(jù)類型要一致。 但是現(xiàn)實情況下,我們經(jīng)常遇到不是純數(shù)值的數(shù)組

    2024年02月12日
    瀏覽(29)
  • WPF 界面結(jié)構(gòu)化處理

    WPF 界面結(jié)構(gòu)化處理

    WPF 框架是開源的,但是不能跨平臺,可以使用MAUI,這個框架可以跨平臺,WPF源碼可以在github上下載,下載地址:https://gitbub.com/dotnet/wpf。 框架結(jié)構(gòu) 如圖 XAML:eXtensible Application Markup Language的英文縮寫,相應(yīng)的中文名稱為:可擴(kuò)展應(yīng)用程序標(biāo)記語言。 命名空間 默認(rèn) 映射:x/

    2024年02月13日
    瀏覽(32)
  • 結(jié)構(gòu)化流的介紹

    結(jié)構(gòu)化流的介紹

    目錄 有界數(shù)據(jù)和無界數(shù)據(jù) 有界數(shù)據(jù) ?無界數(shù)據(jù) ?結(jié)構(gòu)化流 基本介紹 入門案例 結(jié)構(gòu)化流的編程模型 數(shù)據(jù)結(jié)構(gòu) 數(shù)據(jù)源(Source) File Source Kafka Source(Spark 和 Kafka 整合) 整合Kafka準(zhǔn)備工作 從kafka中讀取數(shù)據(jù) 流式處理 批處理 ?數(shù)據(jù)寫入Kafka中 流式處理 批處理 有界數(shù)據(jù) 數(shù)據(jù)有固定的開

    2024年01月15日
    瀏覽(29)
  • 結(jié)構(gòu)化流(Structured Streaming)

    結(jié)構(gòu)化流(Structured Streaming)

    有界數(shù)據(jù): 無界數(shù)據(jù): 結(jié)構(gòu)化流是構(gòu)建在Spark SQL處理引擎之上的一個流式的處理引擎,主要是針對無界數(shù)據(jù)的處理操作。對于結(jié)構(gòu)化流同樣也支持多種語言操作的API:比如 Python Java Scala SQL … Spark的核心是RDD。RDD出現(xiàn)主要的目的就是提供更加高效的離線的迭代計算操作,RDD是針

    2024年01月17日
    瀏覽(23)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包