2013-12-23 51 views
0

我是ElasticSearch新手,請原諒我的愚蠢行爲。ElasticSearch:字段未返回

我似乎無法從ES獲得keepalive字段。

{ 
     "_index" : "2013122320", 
     "_type" : "log", 
     "_id" : "Y1M18ZItTDaap_rOAS5YOA", 
     "_score" : 1.0 
    } 

我能得到其他領域出來的CDN:

{ 
     "_index" : "2013122320", 
     "_type" : "log", 
     "_id" : "2neLlVNKQCmXq6etTE6Kcw", 
     "_score" : 1.0, 
     "fields" : { 
     "cdn" : "-" 
     } 
} 

的映射有:

{ 
    "log": { 
    "_timestamp": { 
     "enabled": true, 
     "store": true 
    }, 
    "properties": { 
     "keepalive": { 
     "type": "integer" 
     } 
    } 
    } 
} 

編輯

我們創建每隔一小時的新指標使用以下Perl代碼

create_index(
index => $index, 
settings => { 
    _timestamp => { enabled => 1, store => 1 }, 
    number_of_shards  => 3, 
    number_of_replicas => 1, 
}, 
mappings => { 
    varnish => { 
    _timestamp => { enabled => 1, store => 1 }, 
    properties => { 
    content_length => { type => 'integer' }, 
    age => { type => 'integer' }, 
    keepalive => { type => 'integer' }, 
    host  => { type => 'string', index => 'not_analyzed' }, 
    time  => { type => 'string', store => 'yes' }, 
<SNIPPED> 
    location => { type => 'string', index => 'not_analyzed' }, 

    } 
    } 
} 
); 

回答

0

有了這麼少的信息,我只能猜測: 在你給的映射中,keepalive沒有明確存儲,而elasticsearch默認爲no。如果你沒有存儲字段,你只能通過完整的源代碼來獲取它,這是默認存儲的。或者你改變了,映射,添加(「存儲」:「是」)到你的領域和重新索引。

祝你好運ES,值得花幾天時間學習。

+0

感謝您的回覆,DeH。你需要什麼更多的信息,我會嘗試收集它。我們有一個perl腳本,每小時創建一個新的索引。 我想我應該添加商店=>'是'我的Keepalive領域像時間字段? 代碼在我原來的帖子上面。 再次感謝 – user3130744

相關問題