Indexing computed/scripted fields

Hi,

how to to index computed/scripted fields in elasticsearch?
i see from documentation that it is possible to run scripts on update and
query, but i cant find anything about indexing
feels like it will be quite useful feature

the problem i have is, that im trying to index json document that have
latitude and longitude as 2 separate fields, for example:

{
"title" : "some title",
"description" : "some description",
"latitude" : 53.32,
"longitude" : -6.12
}

and i want to index it into geo_point field in elasticsearch
i will like to avoid any transformations of the document before indexing
(as i pull json objects from external source and index them into
elasticsearch without "understanding" the document structure)

so what im looking for is to be able to define mapping for that field like
that:

"mappings" :
{
"comment" :
{
"properties" :
{
"latitude" : { "type" : "float" },
"longitude" : { "type" : "float" },
* "location" :
*

  •    { *
    
  •        "type" : "geo_point", *
    
  • "script" : "doc['latitude'].value + ' ,' + doc['longitude'].value'"*
  •    }*
    
    }
    }
    }

is it possible with elasticsearch ?

thx,

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

just in case someone else will have similar problem,
i created elasticsearch plugin for handling computed fields:

Cheers,

On Tuesday, October 15, 2013 6:36:05 PM UTC+1, Karol Gwaj wrote:

Hi,

how to to index computed/scripted fields in elasticsearch?
i see from documentation that it is possible to run scripts on update and
query, but i cant find anything about indexing
feels like it will be quite useful feature

the problem i have is, that im trying to index json document that have
latitude and longitude as 2 separate fields, for example:

{
"title" : "some title",
"description" : "some description",
"latitude" : 53.32,
"longitude" : -6.12
}

and i want to index it into geo_point field in elasticsearch
i will like to avoid any transformations of the document before indexing
(as i pull json objects from external source and index them into
elasticsearch without "understanding" the document structure)

so what im looking for is to be able to define mapping for that field like
that:

"mappings" :
{
"comment" :
{
"properties" :
{
"latitude" : { "type" : "float" },
"longitude" : { "type" : "float" },

  • "location" : *
  •    { *
    
  •        "type" : "geo_point", *
    
  • "script" : "doc['latitude'].value + ' ,' + doc['longitude'].value'"*
  •    }*
    
    }
    }
    }

is it possible with elasticsearch ?

thx,

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

So this is not possible right? It would be really easy to have such a
feature in our mappings.

On Wednesday, 16 October 2013 01:36:05 UTC+8, Karol Gwaj wrote:

Hi,

how to to index computed/scripted fields in elasticsearch?
i see from documentation that it is possible to run scripts on update and
query, but i cant find anything about indexing
feels like it will be quite useful feature

the problem i have is, that im trying to index json document that have
latitude and longitude as 2 separate fields, for example:

{
"title" : "some title",
"description" : "some description",
"latitude" : 53.32,
"longitude" : -6.12
}

and i want to index it into geo_point field in elasticsearch
i will like to avoid any transformations of the document before indexing
(as i pull json objects from external source and index them into
elasticsearch without "understanding" the document structure)

so what im looking for is to be able to define mapping for that field like
that:

"mappings" :
{
"comment" :
{
"properties" :
{
"latitude" : { "type" : "float" },
"longitude" : { "type" : "float" },

  • "location" : *
  •    { *
    
  •        "type" : "geo_point", *
    
  • "script" : "doc['latitude'].value + ' ,' + doc['longitude'].value'"*
  •    }*
    
    }
    }
    }

is it possible with elasticsearch ?

thx,

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1684c0fe-9175-443f-a9b5-570660d7c0b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.