Elasticsearch的差异'字段类型

时间:2015-07-22 08:04:24

标签: elasticsearch

因此,有源字段,文档字段和存储字段。但它们之间的区别是什么?我读过关于它的the documentation,但它们对我来说仍然是一样的。然后还有script fields

也许作为一个起点:

Public Sub ButExportExcel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButExportExcel.Click

'*** take the paging and sorting out of the excel spreadsheet

Try
Dim sgv As GridView = CType(ContentPlaceHolder_body.FindControl("SummaryGridView"), GridView)
        If (sgv IsNot Nothing) Then
            sgv.AllowPaging = False
            sgv.AllowSorting = False
            sgv.DataBind()
        End If

        Dim sExportFileName As String = ""

        sExportFileName = Path.GetFileName(Request.PhysicalPath)
        sExportFileName = sExportFileName.Substring(0, sExportFileName.Length - 5) & ".xls"

        Export2(sExportFileName, sgv)

Catch ex As Exception

End Try

End Sub

'Export Sub
Public Sub Export2(ByVal fileName As String, ByVal gv As GridView)
    Dim sExportFileName As String = ""
    Dim sStringToReplace As String = ""

    gv.HeaderStyle.ForeColor = Drawing.Color.Black
    gv.HeaderStyle.BackColor = Drawing.Color.White
    gv.RowStyle.BackColor = Drawing.Color.White
    gv.HeaderStyle.Font.Bold = True
    gv.HeaderStyle.Font.Size = 10

    sExportFileName = Path.GetFileName(Request.PhysicalPath)
    sExportFileName = sExportFileName.Substring(0, sExportFileName.Length - 5) & ".xls"

    Dim attachment As String = "attachment; filename=" & sExportFileName
    HttpContext.Current.Response.ClearContent()
    HttpContext.Current.Response.AddHeader("content-disposition", attachment)
    HttpContext.Current.Response.ContentType = "application/ms-excel"
    Dim stw As New StringWriter()
    Dim htextw As New HtmlTextWriter(stw)

    Dim parent As Control = gv.Parent
    Dim GridIndex As Integer = 0
    If parent IsNot Nothing Then
        GridIndex = parent.Controls.IndexOf(gv)
        parent.Controls.Remove(gv)
    End If

    gv.RenderControl(htextw)

    If parent IsNot Nothing Then
        parent.Controls.AddAt(GridIndex, gv)
    End If

    'gv.RenderControl(htextw)
    HttpContext.Current.Response.Write(stw.ToString())
    Dim fi As New FileInfo(Server.MapPath("../JumpStart.css"))
    Dim sb As New System.Text.StringBuilder()
    Dim sr As StreamReader = fi.OpenText()
    'sStringToReplace = "class=""generalheader"""
    While sr.Peek() >= 0
        sb.Append(sr.ReadLine())
    End While
    sr.Close()

    Dim outputHtml = "<html><head><style type='text/css'>" + sb.ToString() + "</style></head>" + stw.ToString() + "</html>"

    Response.Write(outputHtml.ToString)

    'Response.Write("<html><head><style type='text/css'>" + sb.ToString() + "</style></head>" + stw.ToString() + "</html>")
    stw = Nothing
    htextw = Nothing
    Response.Flush()
    Response.[End]()


End Sub

和这个查询:

$ curl -XPUT 'http://localhost:9200/my-index/my-type/1' -d '{
    "@timestamp": "2015-07-22T09:00:00.000Z",
    "user": "sjngm",
    "message": "It's kinda warm in here",
    "happiness": 89
}'

相比
{
  "query": {
    "filtered": {
      "filter": {
        "script": {
          "script": "doc['happiness'].value > 50" }}}}}

抛出NullPointerException:

{
  "query": {
    "filtered": {
      "filter": {
        "script": {
          "script": "_source['happiness'] > 50" }}}}}

这些类型代表什么?他们来自哪里?我什么时候使用?

也许是一个额外的问题:是否有可能在&#34; hits / hits / _source&#34;中产生额外的字段。在上述任何一个回应?也许有一些脚本字段?

有人可以用简单的英文提供解释吗?

1 个答案:

答案 0 :(得分:0)

  • int new_var = 0x11223344; unsigned char byte0 = INT_TO_4BYTE_ARRAY(new_var)[0]; unsigned char byte1 = INT_TO_4BYTE_ARRAY(new_var)[1]; unsigned char byte2 = INT_TO_4BYTE_ARRAY(new_var)[2]; unsigned char byte3 = INT_TO_4BYTE_ARRAY(new_var)[3]; 提供doc["my-field"].value,完全独立于filters =&gt;加载fielddata中的所有值快,使用大量的RAM
  • *.raw将文档作为压缩的JSON从磁盘加载并解析它以获取字段=&gt;可能需要一些时间,解析是通过streaming =&gt;完成的。以后的字段需要更长的时间才能找到
  • _source["my-field"]仅访问索引中标记的特殊字段。映射为_fields["my-field"].value