Hi Jesse!

> On 23 Jun 2015, at 00:11, Jesse Skrivseth <voodood...@gmail.com> wrote:
> 
> The Message class has several field types that can be explicitly declared 
> when adding fields to messages. It seems to support:
> 
> Double
> Long
> String
> 
> If I want to attach a field as a custom elastic type such as "geo_point", how 
> can I declare this custom type? Without a custom type, my current format 
> would always be inserted as a string. I'd love to be able to:
> 
> msg.addCustomField(String type, String key, Object message)
> 
> so 
> 
> msg.addCustomField('geo_point', 'source_geopoint', "12.023,-57.012”);


Unfortunately this does not work the way you expect it to. The mapping itself 
is being applied when creating the index, and Graylog currently relies on ES 
auto detecting the dynamic mapping types.
Double, Long and String are actually separate data types, thus ES will create 
the correct mapping for them, but geo_point is actually just a String and 
there’s no way to set a mapping type per document during indexing, so even if 
we offered a addCustomField method this would not work as intended.

In the future we want to provide more control over the mapping, but right now 
what you can do is to look at index templates. If your geo_point fields end 
with *_geopoint this should be relatively straightforward to implement.

Please have a look at 
https://www.elastic.co/guide/en/elasticsearch/reference/1.6/indices-templates.html
 
<https://www.elastic.co/guide/en/elasticsearch/reference/1.6/indices-templates.html>

Best,
Kay

-- 
You received this message because you are subscribed to the Google Groups 
"graylog2" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to graylog2+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to