# Full-text queries with date filter

**URL:** <https://discuss.elastic.co/t/full-text-queries-with-date-filter/344391>\
**Category:** Kibana\
**Tags:** eql-elastic-query-language\
**Created:** [October 4, 2023, 1:15pm UTC](https://discuss.elastic.co/t/full-text-queries-with-date-filter/344391 "2023-10-04T13:15:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![combbbbinator](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/combbbbinator/32/123473_2.png) [@combbbbinator](https://discuss.elastic.co/u/combbbbinator)\
**Post date:** [October 4, 2023, 1:15pm UTC](https://discuss.elastic.co/t/full-text-queries-with-date-filter/344391/1 "2023-10-04T13:15:14Z")

</div>

Hello. I'm trying to understand whether it is possible to make a full-text request and specify a time filter in the request, for example, for the last 15 minutes?

A request that I would like to improve :  
{  
"query": {  
"match": {  
"log": "my log"  
}  
}  
}

I want to add something like this to my request:  
{  
"timestamp": {  
"gte": "now-1d",  
"lte": "now"  
}  
}

Any ideas on how to request this?

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [October 4, 2023, 1:38pm UTC](https://discuss.elastic.co/t/full-text-queries-with-date-filter/344391/2 "2023-10-04T13:38:17Z")

</div>

Hi @combbbbinator Welcome to the community.

Think you are looking for this

> **[Query and filter context | Elasticsearch Guide \[8.10\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-filter-context.html)**

---

<div class="post-metadata">

**Author:** ![combbbbinator](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/combbbbinator/32/123473_2.png) [@combbbbinator](https://discuss.elastic.co/u/combbbbinator)\
**Post date:** [October 4, 2023, 2:07pm UTC](https://discuss.elastic.co/t/full-text-queries-with-date-filter/344391/3 "2023-10-04T14:07:41Z")

</div>

If my document contains a field "logs" : "text text log text" then I can find that document using the word "log" and filter the query for the last 15 minutes?

Can you show an example request?

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [October 4, 2023, 2:17pm UTC](https://discuss.elastic.co/t/full-text-queries-with-date-filter/344391/4 "2023-10-04T14:17:51Z")

</div>

There are pretty straightforward example in the doc I just referred you to

the Example

```auto
GET /_search
{
  "query": { 
    "bool": { 
      "must": [
        { "match": { "title": "Search" }},
        { "match": { "content": "Elasticsearch" }}
      ],
      "filter": [ 
        { "term": { "status": "published" }},
        { "range": { "publish_date": { "gte": "2015-01-01" }}}
      ]
    }
  }
}

```

so yours something like

```auto
GET /_search
{
  "query": { 
    "bool": { 
      "must": [
        { "match": { "logs": "log"}}
      ],
      "filter": [ 
        { "range": { "@timestamp": { "gte": "now-15m/m" }}}
      ]
    }
  }
}

```

If you want to do this ... you will need to learn a bit about the Query Language, lots of docs , examples etc.

More Here

> **[Boolean query | Elasticsearch Guide \[8.10\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html)**

> **[Range query | Elasticsearch Guide \[8.10\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/8.10/query-dsl-range-query.html)**

Another way to learn this is to use Discover and then look at the query it Generates those queries can be a bit complex but it can be a good way to learn.

 ![Screenshot 2023-10-04 at 7.20.44 AM](https://us1.discourse-cdn.com/elastic/original/3X/c/d/cd603a1c1b5a03601a21f570b5c36fed42d9969c.jpeg)

---

<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:** [November 1, 2023, 2:18pm UTC](https://discuss.elastic.co/t/full-text-queries-with-date-filter/344391/5 "2023-11-01T14:18:26Z")

</div>

Closed on November 1, 2023, 2:18pm UTC

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