# Create Top slow requests graph

**URL:** <https://discuss.elastic.co/t/create-top-slow-requests-graph/79822>\
**Category:** Kibana\
**Created:** [March 24, 2017, 12:54am UTC](https://discuss.elastic.co/t/create-top-slow-requests-graph/79822 "2017-03-24T00:54:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tkumark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tkumark/32/78397_2.png) [@tkumark](https://discuss.elastic.co/u/tkumark)\
**Post date:** [March 24, 2017, 12:54am UTC](https://discuss.elastic.co/t/create-top-slow-requests-graph/79822/1 "2017-03-24T00:54:00Z")

</div>

Hi

I am completely new to ELK and I just using for log analysis. I need to create a graph that give the top 10 slow web sites. I do know about visualization where we define the x and y axis and also about split line. The problem I am facing is my request url looks like  
**http;//mywebsite/somehtmlpage?q=asdlfkajs;lkdfasff**

I need to aggregate it by "somehtmlpage" average response time but the query parameters seeming to be interfering.

Is there a way to ignore the query parameters and just parse the html pages at the time of search or do I have to some changes to logstash to filter out the query parameters?

---

<div class="post-metadata">

**Author:** ![Stacey\_Gammon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stacey_gammon/32/14025_2.png) [@Stacey\_Gammon](https://discuss.elastic.co/u/Stacey_Gammon)\
**Post date:** [March 24, 2017, 1:46pm UTC](https://discuss.elastic.co/t/create-top-slow-requests-graph/79822/2 "2017-03-24T13:46:41Z")

</div>

You can do this with a painless scripted field, but there are performance limitations with scripted fields (which you can read about here: [https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting-painless.html#modules-scripting-painless-regex](https://www.elastic.co/guide/en/elasticsearch/reference/master/modules-scripting-painless.html#modules-scripting-painless-regex)) so I strongly recommend you update your logstash instead.

However, if you want to go the scripted field route, I got it to work using a regex:

```auto
if (doc['url.keyword'].value !== null) {
  Matcher m = /([a-zA-Z0-9_:.\/]*)\?/.matcher(doc['url.keyword'].value);
  if(m.find()) {
    return m.group(1);
  }
}
return doc['url.keyword'].value;

```

You'll probably have to enable regex in your elasticsearch.yml as well:

```auto
script.painless.regex.enabled: true

```

 ![](https://us1.discourse-cdn.com/elastic/original/3X/7/3/73545684c98eef5b753507886f2dabb3515c986a.png)

But again, go the logstash route if that is an option!

---

<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:** [April 21, 2017, 1:46pm UTC](https://discuss.elastic.co/t/create-top-slow-requests-graph/79822/3 "2017-04-21T13:46:59Z")

</div>

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