Hi 

I have  a mapping which is having the following 2 properties:
                    "start_date": {
                        "format": "dateOptionalTime",
                        "type": "date"
                    },
                    "end_date": {
                        "format": "dateOptionalTime",
                        "type": "date"
                    },

I want to create an histogram for durations with 1 hour intervals by doing 
 this:

curl -XGET 'http://localhost:9200/myindex/travels/_search_search?pretty' -d 
'

{

    "aggs": {

        "duration": {

            "histogram": {

                "interval": 1,

                "script": "(doc['end_date']-doc['start_date'])/3600"

            }

        }

    }

}'

I got the following error:

GroovyScriptExecutionException[MissingPropertyException[No such property: 
end_date for class: Script1]]; }{[B4xwr8FCSnOLkrNAVhgHMg][gequest][2]: 
QueryPhaseExecutionException[[myindex][2]: 
query[ConstantScore(cache(_type:travels))],from[0],size[10]: Query Failed 
[Failed to execute main query]]; nested: 
GroovyScriptExecutionException[MissingPropertyException[No such property: 
end_date for class: Script1]]; }

I have the same error for start_date.


Any idea what I am doing wrong ?


Cheers

Guillaume

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/6ca86563-5881-4004-af35-a258841ec326%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to