elasticsearch结构化查询(一)

news2024/9/22 17:30:16

在上一篇中我们介绍了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" : [ ]
      }
    ]
  }
}

总结

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

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

CentOS 7.6更改yum源

使用字符串替换 我这里的操作参考了https://baijiahao.baidu.com/s?id1708418392526536542&wfrspider&forpc这篇文章&#xff0c;https://mirrors.tuna.tsinghua.edu.cn/help/centos/是清华大学官网教程。 /etc/yum.repos.d/CentOS-Base.repo文件如下&#xff1a; #…

Python的类与对象、构造方法、类与对象三大特性封装、继承和多态、类型注解

类与对象 1.Python的对象 使用对象组织数据 在程序中是可以做到和生活中那样&#xff0c;设计表格、生产表格、填写表格的组织形式的。 在程序中设计表格&#xff0c;我们称之为&#xff1a;设计类(class) class Student: name None #记录学生姓名 在程序中打印生产表格&…

【MySQL】函数和约束

如标题所说,本文重点只有两个:MySQL语句里面的函数和约束 目录 1. 函数1.1 字符串函数1.2 数值函数1.3 日期函数1.4 流程函数 2.约束2.1 外键的删除更新行为 1. 函数 因为在前一篇文章里面有讲到聚合函数,所以在这里就不重复介绍了,本文所介绍的函数有4类:字符串函数,数值函数…

瑞吉外卖+Redis入门到实战教程,深度透析redis底层原理+redis分布式锁+企业解决方案+黑马点评实战项目

瑞吉外卖 Redis基础 Redis入门 redis.io nosql没有表的概念 下载与安装 注意关闭防火墙 systemctl stop firewalld 启动redis src/redis-server ./redis.conf 数据类型 常用命令 字符串 string 操作命令 哈希 hash 操作命令 列表list(类似 栈 )操作命令 集合set 操作命令 sdif…

【源码解析】流控框架Sentinel源码解析

Sentinel简介 Sentinel是阿里开源的一款面向分布式、多语言异构化服务架构的流量治理组件。 主要以流量为切入点&#xff0c;从流量路由、流量控制、流量整形、熔断降级、系统自适应过载保护、热点流量防护等多个维度来帮助开发者保障微服务的稳定性。 核心概念 资源 资源…

【分布式】数据冗余

当我们拥有了许多的存储服务器&#xff0c;且通过将数据在网关进行一致性哈希或者哈希桶的分发之后&#xff0c;我们拥有了一个具有基本负载均衡的系统&#xff0c;但是&#xff0c;此时我们又有新的问题产生了&#xff1a;我们所有的数据只有一份&#xff0c;如果这一份数据丢…

OD工具之动态逆向分析技术实例分析

OD工具之动态逆向分析技术实例分析 vscode等编写cmp.cOD工具打开cmp.exe 卧槽垃圾高级软件工程真是烦人还是记录一下吧那么简单的几行没有手册搞半天都无力吐槽了 vscode等编写cmp.c 在vscode等编辑器中编写cmp.c文件&#xff1a; #include<stdio.h> int main() {int …

手机信息管理系统【控制台+MySQL】(Java课设)

系统类型 控制台类型Mysql数据库存储数据 使用范围 适合作为Java课设&#xff01;&#xff01;&#xff01; 部署环境 jdk1.8Mysql8.0Idea或eclipsejdbc 运行效果 本系统源码地址&#xff1a;https://download.csdn.net/download/qq_50954361/87737284 更多系统资源库地…

CTFshow Web入门 命令执行

目录 web29 web30 web31 web32 web33 web34 web35 web36 web37 web38 web39 web40 web41 web42 web43 web44 web45 web46 web47 web48 web49 web50 web51 web52 web53 web54 web55 web56 web57 web58 web59 web60-65 web66 web67 web68 we…

Spring Boot相关概念、创建与运行

文章目录 一、Spring Boot的创建与使用&#xff08;一&#xff09;为什么要学习 Spring Boot&#xff1f;&#xff08;二&#xff09;Spring Boot的优势&#xff08;三&#xff09;Spring Boot的创建1. 安装插件2. 创建项目3. 配置国内源4. 删除无效目录 &#xff08;四&#x…

祝大家劳动节快乐

文章目录 为我的笔记整理了一个小目录 Python基础 Python基础——0.Python环境的安装 Python基础——1.变量和简单数据类型 Python基础——2.列表简介 Python基础——3.操作列表 Python基础——4.if语句 Python基础——5.字典 Python基础——6.用户输入和while循环 Python基…

【王道·计算机网络】第二章 物理层【未完】

一、通信基础 1. 基本概念 1.1 物理层接口特性 物理层解决如何在连接各种计算机的传输媒体上传输比特流&#xff0c;不指定具体的传输媒体主要任务&#xff1a;确定与传输媒体接口有关的一些特性 → 定义标准接口特性&#xff1a; 机械特性&#xff1a;定义物理连接的特性&a…

十分钟点亮iCLed35

文章目录 前言iCLed35整体介绍iCLed概念iCLed系列产品优势iCLed35(6pin)的特性&#xff1a; iCLed35(6pin)的硬件设计iCLed35(6pin)的软件配置通讯时序&#xff1a;通讯协议介绍&#xff1a;整体的数据结构&#xff1a;睡眠模式&#xff1a; 点亮iCLed35(6pin)S32K144EVB配置驱…

linux入门---软硬链接

软链接 使用指令ln -s 被链接的文件 生成的软链接文件 便可以创建软连接文件&#xff0c;ln是link的简写表明当前要创建链接文件&#xff0c;s是soft的简写表明当前创建的链接文件为软链接文件&#xff0c;然后加上被链接的文件&#xff0c;最后写上生成的链接文件的文件名比如…

【谷粒商城之服务认证OAuth2.0】

本笔记内容为尚硅谷谷粒商城服务认证OAuth2.0部分 目录 一、OAuth 2.0 二、微博登录测试 1、微博登陆准备工作 2、获取微博Access Token 3、登录测试 1.添加HttpUtils工具类 2.controller 3.service 4.vo 总结 一、OAuth 2.0 OAuth&#xff1a; OAuth&#xff08;开…

【账号激活】

由于注册时会遇到诸多错误提示&#xff01;所以出此详细教程。 重点是要巧妙的运用无痕浏览窗口。 步骤分为两步&#xff0c;sign up 激活邮箱以及 log in 短信验证码验证。 右上角新建无痕浏览窗口。新建完后记得关闭此有痕浏览窗口。 成功创建。完成第一步。 若要连续操作切记…

双极性信号、正交信号和PAM信号通信系统matlab程序+仿真

资源地址&#xff1a; 双极性信号、正交信号和PAM信号通信系统MATLAB程序仿真资源-CSDN文库 部分程序及仿真图&#xff1a; clear all EbN00:10; %SNR的范围 for ii1:length(EbN0) SNREbN0(ii); %赋值给AWGN信道模块中的SNR sim(ex5); %运行仿…

【Java笔试强训 24】

&#x1f389;&#x1f389;&#x1f389;点进来你就是我的人了博主主页&#xff1a;&#x1f648;&#x1f648;&#x1f648;戳一戳,欢迎大佬指点! 欢迎志同道合的朋友一起加油喔&#x1f93a;&#x1f93a;&#x1f93a; 目录 一、选择题 二、编程题 &#x1f525;年终奖 …

一般对称性和轮换对称性

一般对称性 一元函数的对称性 几何意义是所围图形的面积绝对值 【注】使用对称性的时候&#xff0c;首先抓积分区域关于哪个轴对称&#xff0c;其次抓被积函数是为另一轴的奇&#xff08;偶函数&#xff09;。 二元函数的对称性(奇偶性) 【注】在一般对称性中&#xff0c;(x…

MCU固件升级系列1(STM32)

本系列将从升级流程、boot代码编写、APP代码编写以及固件打包来介绍&#xff0c;硬件选用STM32F407ZGT6&#xff08;手里只有&#xff09;&#xff0c;来完成这系列教程。 前言 为什么需要固件升级: 功能更新&#xff1a;随着产品的迭代和用户需求的变化&#xff0c;可能需要…