# Elasticsearch score query with logstash does not work

**URL:** <https://discuss.elastic.co/t/elasticsearch-score-query-with-logstash-does-not-work/163165>\
**Category:** Logstash\
**Created:** [January 7, 2019, 8:23am UTC](https://discuss.elastic.co/t/elasticsearch-score-query-with-logstash-does-not-work/163165 "2019-01-07T08:23:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pastechecker](https://avatars.discourse-cdn.com/v4/letter/p/0ea827/32.png) [@pastechecker](https://discuss.elastic.co/u/pastechecker)\
**Post date:** [January 7, 2019, 8:23am UTC](https://discuss.elastic.co/t/elasticsearch-score-query-with-logstash-does-not-work/163165/1 "2019-01-07T08:23:23Z")

</div>

Hello.

I have a working scoring query with decay exponential function calculated from a date. I want to use scheduler in logstash to run the query every 1h, score the results, and export it to json or csv.

My logstash configuration is:

> input {  
> elasticsearch {  
> hosts =\> ["elastic1.lan", "elastic1.lan"]  
> index =\> "ti"  
> query =\> '{  
> "query": {  
> "function\_score": {  
> "query":{"bool":{"must":[{"exists":{"field":"url"}},{"match":{"tags":"url"}},{"match":{"tags":"valid"}},{"range":{"@timestamp":{"gte":"now-14d","lte":"now"}}}],"must\_not":{"match":{"tags":"\_grokparsefailure"}}}},  
> "exp": {  
> "@timestamp": {  
> "origin": "now-1h",  
> "scale": "14d",  
> "offset": "12h",  
> "decay" : 0.6  
> }  
> },"boost": "28","score\_mode": "max","boost\_mode":"multiply"  
> }  
> }  
> }  
> '  
> size =\> 1000  
> scroll =\> "1m"  
> docinfo =\> true  
> schedule =\> "47 \* \* \* \*"  
> }  
> }  
> filter {}
> 
> output {  
> file {  
> codec =\> "json"  
> path =\> ["/tmp/export.%{+YYYY-MM-dd}\_scored\_urls.json"]  
> }  
> }

Is there any way to run this and get the score in json out from Logstash level?  
Or should I not use logstash and stay with other tools like a bash script and cron, or python and crone to run the query I want and export it to whatever format I want?

Thanks for hints.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 4, 2019, 8:23am UTC](https://discuss.elastic.co/t/elasticsearch-score-query-with-logstash-does-not-work/163165/2 "2019-02-04T08:23:27Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
