elasticsearch结构化查询(一)

在上一篇中我们介绍了DSL相关的知识,接下来我们将会学习elasticsearch的结构化查询,同时也实践一下上一篇的DSL的查询用法

什么是结构化搜索?

从《Elasticsearch权威指南》上摘取部分解释如下:

		结构化搜索是指查询包含内部结构的数据。日期,时间,和数字都是结构化的:它们有明确的格式给你执行逻辑
	操作。一般包括比较数字或日期的范围,或确定两个值哪个大。文本也可以被结构化。一包蜡笔有不同的颜色:
	红色 , 绿色 , 蓝色 。一篇博客可能被打上 分布式 和 搜索 的标签。电子商务产品有商品统一代码(UPCs)
	或其他有着严格格式的标识。
		通过结构化搜索,你的查询结果始终是是或非;是否应该属于集合。结构化搜索不关心文档的相关性或分数,
	它只是简单的包含或排除文档。这必须是有意义的逻辑,一个数字不能比同一个范围中的其他数字 更多。它只能
	包含在一个范围中或不在其中。类似的,对于结构化文本,一个值必须相等或不等。这里没有更匹配的概念。

从上面的定义我们可以看出来结构化查询最重要的就是是否匹配么人并不是很关心相关性和分值计算。所以接下来我们将会一一介绍不同的结构化查询。

Term查询

term 主要用于查找精确值,由于不需要计算分值,而且可以被缓存,所以速度很快,而且term查询主要针对的是数字,日期,布尔值或 not_analyzed 的字符串(未经分析的文本数据类型)。
首先我们使用term查询一下:

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

返回结果:

{
  "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" : [ ]
      }
    ]
  }
}

我们发现结果好像并不尽如人意,那么我们再试一个,这次我们把他修改成年龄字段搜索:

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

返回结果:

{
  "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" : [ ]
      }
    ]
  }
}

根据上面的结果,我们再一次验证了,term查询只针对精确值、布尔值、日期以及未经分析的字段,而如果我们用term去查询一些单词或者句子等,就会匹配不到对应的值,为什么呢?官网其实也给出了解释,在下图中就可以看到,其实是因为我们es默认的标准分词器可能将我们要查询的句子或者单词变成小写了,或者拆分了,而我们的term查询又是精确查询,所以不会分析我们的搜索字段的,从而导致term查询一些单词和短语时,很难得到满意的结果。当然这也是官方提醒我们要避免的,官方建议我们使用match来匹配查询一些单词和短语,效果要比term好。
传送门
如图所示:
在这里插入图片描述
在这里插入图片描述
这里我就不翻译了,如果想学习更多,可以自行阅读官方文档。

Terms查询

terms查询其实就是类似整合多个term查询。如例子所示:

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

返回结果:

{
  "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" : [ ]
      }
    ]
  }
}

当然在term中需要注意的在这里同样需要。terms也是同样是精确查询。这里提一嘴terms lookup的用法,先看lookup的例子:

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

返回结果:

{
  "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下的指定的字段的值一样的文档有哪些。效率虽然高,但是限制也比较多,可自行查看官网描述的相关限制,传送门

range查询

range查询即范围查询,主要包括数字查询和日期查询,当然也可以查询文本,但是要将search.allow_expensive_queries设置为true。

查询数字

查询的结构如下:

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

其中范围查询的参数有:
gte:大于等于
gt:大于
lt:小于
lte:小于等于
format:主要用来格式化日期的
time_zone:时区
查询数字的返回结果为:

{
  "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" : [ ]
      }
    ]
  }
}

日期范围

由于这里我们的例子中没有日期相关的数据,所以我们再导入一份含有日期数据的文件到es中。即logs.jsonl
同样通过命令行导入的方式:

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

因为这里导入的数据比较大,可能会报数据量过大的错误,此时需要修改es的内存大小,因为我们在前面使用docker安装es的时候,启动的时候,设置了es的java虚拟机内存使用大小为256m,所以这里我们需要将es集群关闭之后,重新启动,如下所示:

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"已经修改为1g了,然后启动,其他两个节点同样需要这样的操作。
最后导入数据即可。

从图中可知我们已经导入成功了,
在这里插入图片描述
这里我们开始学习range的查询日期用法:
在这里我们查询日志的utc_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"
        }
    }
  }
}

返回结果:

{
  "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"
        }
      }
    ]
  }
}

准确的输出了日期2015-05-19T04:29:38.264Z与2015-05-30T04:29:38.264Z之间的数据。

小结

关于range的查询基本就这么多,还有部分关于字符串的,过于简单就不做详细的叙述,因为字符串的查询是直接利用的字典序查询,不如是用其他方式直接查询字符串。还有关于ip的范围查询,但是实在聚合查询中体现的,在range中好像并没法使用。

Exists查询

exists查询的主要意思是字段是否存在值,如果不存在值,则不会被查询出来,如果有值,则会被查询出来,null的情况下也不会被查询出来。
这里我就直接查询了,因为数据量比较大,所以只展示用法,数据是否为null等就算了,嘿嘿

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

返回结果:

{
  "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" : [ ]
      }
    ]
  }
}

总结

结构化查询的第一部分基本就这么多,后面还会学习第二部分的,关于模糊查询方面的。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/20458.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

MATLAB 之 函数文件、特殊形式的函数和程序调试与优化

文章目录 一、函数文件1. 函数文件的基本结构2. 函数调用2.1 函数调用的格式2.2 函数的递归调用2.3 函数参数的可调性2.4 全局变量与局部变量 二、特殊形式的函数1. 子函数2. 内联函数3. 匿名函数 三、程序调试与优化1. 程序调试方法1.1 利用调试函数进行程序测试1.2 利用调试工…

MySQL数据库,JDBC连接数据库操作流程详细介绍

前言&#xff1a; 在学完 MySQL 和 Java 后&#xff0c;我们通常会尝试使用 Java编译器 连接 MySQL数据库&#xff0c;从而达到使用编译器来操作数据库的效果。连接的这个过程会用 JDBC 相关知识&#xff0c;因此我把 JDBC 包的下载及导入流程&#xff0c;以及 JDBC 的使用流程…

1.Buffer_Overflow-1.Basic_Jump

github上面的练习题 git clone https://github.com/Adamkadaban/LearnPwn 然后开始做 先进行 readelf 然后进行执行看看 是怎么回事 ./buf1发现就是一个输入和输出 我们checksec看看 发现stack 保护关闭 开启了NX保护 我们进入ida64看看反汇编 我习惯先看看字符串 SHITF…

C#异步编程之数据并行及任务并行

基于Parallel.ForEach的数据并行使用 1.数据非并行 var items new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; DateTime t1 DateTime.Now; foreach (var item in items) {Console.WriteLine("数据非并行输出:{0}", item); } 2.数据并行,只要使用Parallel.ForEach P…

Docker高频使用命令总结(镜像与容器命令)

目录 一.Docker常用命令总结 1.镜像命令管理 2.容器命令管理 二.Docker镜像操作命令 1.docker search&#xff1a;搜索镜像 2.docker pull&#xff1a;下载镜像 3.docker push&#xff1a;上传镜像 4.docker images&#xff1a;查看本地镜像 5.docker inspect &#x…

360+ChatGLM联手研发中国版“微软+OpenAI”

文章目录 前言360与智谱AI强强联合什么是智谱AI360智脑360GLM与360GPT大模型战略布局写在最后 前言 5月16日&#xff0c;三六零集团&#xff08;下称“360”&#xff09;与智谱AI宣布达成战略合作&#xff0c;双方共同研发的千亿级大模型“360GLM”已具备新一代认知智能通用模…

Springboot——事物管理

文章目录 事务管理一、 Spring事务管理1.1 事务回顾1.2 案例&#xff1a; 解散部门&#xff08;未开启事务&#xff09;1.3 事务管理注解Transactional1.4 事务管理日志开关1.5 rollbackFor 异常回滚属性1.6 propagation 事务传播行为1.7 解散部门并记录操作日志1.7.1 创建数据…

技术探秘:揭秘Bean Factory与FactoryBean的区别!

大家好&#xff0c;我是小米&#xff0c;一个热衷于技术分享的29岁小编。今天&#xff0c;我们来聊一聊在Spring框架中常用的两个概念&#xff1a;beanFactory和FactoryBean。它们虽然看似相似&#xff0c;但实际上有着不同的用途和作用。让我们一起来揭开它们的神秘面纱吧&…

离散数学_九章:关系(6)

&#x1fa90;9.6 偏序 1、⛺偏序关系和偏序集⛲偏序关系⛲偏序&#xff08;关系&#xff09;的例子 a. “大于或等于” 关系b. “整除” 关系c. “包含” 关系 &#x1f3ac;偏序集&#x1f3ac;可比性&#xff08;comparability&#xff09; " ≼ " 符号a. 可比 &a…

基于野火F407骄阳开发板的苹果采摘机器人机械臂的采摘轨迹与夹持器的采摘动作的设计(1)

基于野火F407骄阳开发板的苹果采摘机器人机械臂的采摘轨迹与夹持器的采摘动作的设计&#xff08;1&#xff09; 苹果采摘机器人1、采摘流程与硬件设计2、机械臂驱动以及采摘轨迹设计2.1、台达A2电机驱动实现2.2、机械臂寻找苹果巡逻轨迹 苹果采摘机器人 1、采摘流程与硬件设计…

C++/Qt 小知识记录3

工作中遇到的一些小问题&#xff0c;总结的小知识记录&#xff1a;C/Qt 小知识 QLineEdit限制输入大于0的正整数QLayout内清空已布局的WidgetWindows结束进程直接结束&#xff0c;子进程不响应结束事件正常结束&#xff0c;子进程响应结束事件 CMake关闭控制台Console实体与值对…

尾调用优化

尾调用优化 最近遇到一个堆栈溢出的问题&#xff0c;分析后发现可收敛为递归边界问题。结合“红宝书”中相关内容和ES6规范中的一些优化机制&#xff0c;整理记录如下。 前言 程序运行时&#xff0c;计算机会为应用程序分配一定的内存空间。应用程序会自行分配所获得的内存空…

数组或结构体赋值时memcpy与直接赋值的效率比较

先上结论&#xff1a; 二者不一定谁快通常情况下&#xff0c;数组维度越大&#xff0c;使用memcpy效率更高数组维度越大&#xff0c;直接赋值耗时主体是循环耗时 Note&#xff1a; “等号赋值”被编译器翻译成一连串的MOV指令&#xff0c;而memcpy则是一个循环。“等号赋值”比…

深入解析PyTorch中的模型定义:原理、代码示例及应用

❤️觉得内容不错的话&#xff0c;欢迎点赞收藏加关注&#x1f60a;&#x1f60a;&#x1f60a;&#xff0c;后续会继续输入更多优质内容❤️ &#x1f449;有问题欢迎大家加关注私戳或者评论&#xff08;包括但不限于NLP算法相关&#xff0c;linux学习相关&#xff0c;读研读博…

【一起啃书】《机器学习》第六章 支持向量机

文章目录 第六章 支持向量机6.1 间隔和支持向量6.2 对偶问题6.3 核函数6.4 软间隔与正则化6.5 支持向量回归6.6 核方法6.7 一些问题 第六章 支持向量机 6.1 间隔和支持向量 给定训练样本集 D { ( x 1 , y 1 ) , ( x 2 , y 2 ) , . . . , ( x m , y m ) } , y i ∈ { − 1 , …

Day 1 认识软件测试——(软件测试定义、目的、原则)

Day 1 认识软件测试——(软件测试定义、目的、原则) 文章目录 Day 1 认识软件测试——(软件测试定义、目的、原则)软件测试的定义软件测试的目的软件测试的经济学问题黑盒测试白盒测试软件测试原则小结所谓软件测试,就是一个过程或一系列过程,用来确定计算机代码完成了其…

《我命由我不由天》蔡志忠——笔记一

目录 简介 经典摘录 三岁决定一生 父母该什么时候放手 确定将来要成为什么 积极主动为目标而努力 叛逆是最伟大的创意 父亲给蔡志忠最大的影响是教会他两件事 价值观缺陷导致的后果 人有三个阶段 简介 作者 蔡志忠&#xff0c;李虹。 蔡志忠&#xff1a;漫画家、哲…

Vue加SpringBoot实现项目前后端分离

首先需要搭建一个Vue的脚手架项目&#xff08;已经放在gitee里面了&#xff0c;下面是gitee网址&#xff0c;可以直接拉&#xff09; (vue-web: 这个是Vue项目模板&#xff0c;没有后台数据) 那么接下来就是实现前后端分离的步骤 首先我们需要有一个登录页面 登录的点击事件利用…

图神经网络:(节点分类)在KarateClub数据集上动手实现图神经网络

文章说明&#xff1a; 1)参考资料&#xff1a;PYG官方文档。超链。 2)博主水平不高&#xff0c;如有错误还望批评指正。 3)我在百度网盘上传了这篇文章的jupyter notebook。超链。提取码8888。 文章目录 文献阅读&#xff1a;代码实操&#xff1a; 文献阅读&#xff1a; 参考文…

【Hello Algorithm】归并排序及其面试题

作者&#xff1a;小萌新 专栏&#xff1a;算法 作者简介&#xff1a;大二学生 希望能和大家一起进步 本篇博客简介&#xff1a;介绍归并排序和几道面试题 归并排序及其面试题 归并排序归并排序是什么归并排序的实际运用归并排序的迭代写法归并排序的时间复杂度 归并排序算法题小…