# Kibana regex search with range or number

**URL:** <https://discuss.elastic.co/t/kibana-regex-search-with-range-or-number/71012>\
**Category:** Kibana\
**Created:** [January 10, 2017, 3:33am UTC](https://discuss.elastic.co/t/kibana-regex-search-with-range-or-number/71012 "2017-01-10T03:33:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![quangtranhong](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/quangtranhong/32/14411_2.png) [@quangtranhong](https://discuss.elastic.co/u/quangtranhong)\
**Post date:** [January 10, 2017, 3:33am UTC](https://discuss.elastic.co/t/kibana-regex-search-with-range-or-number/71012/1 "2017-01-10T03:33:31Z")

</div>

I have a log already indexed in to field like below

cs\_uri\_stem: /book-music  
cs\_uri\_query: p=119

recently, my website has been crawled with a very deep page number ( ask you can see in the example, page 119), and that stress to my site very much

my question is, how could you define the search, that only filter the query with the page number greater than 100

I follow the instruction on es website but it doesn't work for me unfortunately [Regexp query | Elasticsearch Guide [8.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-regexp-query.html)

> Interval The interval option enables the use of numeric ranges, enclosed by angle brackets "\<\>". For string: "foo80":

> foo\<1-100\> # match  
> foo\<01-100\> # match  
> foo\<001-100\> # no match

here is my query on kibana

cs\_uri\_stem: /book-music AND cs\_uri\_query: p=\<100-999\> =\> doesn't work

if I specify the page number, it works well

cs\_uri\_stem: /book-music AND cs\_uri\_query: p=119 =\> this works well

thank you in adv

---

<div class="post-metadata">

**Author:** ![weltenwort](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weltenwort/32/53885_2.png) [@weltenwort](https://discuss.elastic.co/u/weltenwort)\
**Post date:** [January 10, 2017, 9:47am UTC](https://discuss.elastic.co/t/kibana-regex-search-with-range-or-number/71012/2 "2017-01-10T09:47:44Z")

</div>

Hi @quangtranhong,

here are two ways to achieve your goal:

1. To get your regular expression working, you have to enclose the string in `/` for the parser to recognize it as a [regexp query string](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_regular_expressions): `cs_uri_query:/p=<100-999>/`.

2. From your description I take it that `cs_uri_query` is indexed as text. If it was indexed as a number field, e.g. `query_page`, you would be able to use a [range query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_ranges) to select the documents: `query_page:[100 to *]`. The recommended way would be to parse the `cs_uri_query` field at index time in [Logstash](https://www.elastic.co/de/products/logstash), an [index pipeline](https://www.elastic.co/guide/en/elasticsearch/reference/5.1/ingest.html) or whatever piece of software you are using to ingest the documents into Elasticsearch.

---

<div class="post-metadata">

**Author:** ![quangtranhong](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/quangtranhong/32/14411_2.png) [@quangtranhong](https://discuss.elastic.co/u/quangtranhong)\
**Post date:** [January 10, 2017, 11:11am UTC](https://discuss.elastic.co/t/kibana-regex-search-with-range-or-number/71012/3 "2017-01-10T11:11:37Z")

</div>

> cs\_uri\_query:/p=\<100-999\>/

this really does work, many thanks, @weltenwort

---

<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 7, 2017, 11:12am UTC](https://discuss.elastic.co/t/kibana-regex-search-with-range-or-number/71012/4 "2017-02-07T11:12:27Z")

</div>

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