Date range query with another query

I have 2 queries like this and i have to apply date range filter, is it possible to merge the 2 queries, i am applying search on the same index in 2 queries.


first query

GET index_1/_search
{
  "_source": ["file.filename"], 
  "query": {
    "range": {
      "publication_datetime_converted": {
        "time_zone": "+01:00",        
        "gte": "2022-05-30 00:00:00", 
        "lte": "2022-07-01 00:00:00"
      }
    }
  }
}

second query

GET index_1/_search
{
		"size": 4000,
		"sort": [
    { "file.filename": "asc" }],
		"_source": ["file.filename"],
		"query": {
			"bool": {
				"must": [{
					"match": {
						"content": {
							"query": "rohit",
							"operator": "and"
						}
					}
				}, {
					"match": {
						"content": {
							"query": "kohli",
							"operator": "and"
						}
					}
				}, {
					"match": {
						"content": {
							"query": "raina",
							"operator": "and"
						}
					}
				}, 
				{
					"match": {
						"content": {
							"query": "dhoni"
						}
					}
				}
				]
			}
		},
		"highlight": {
			"fields": {
				"content": {}
			}
		}
	}

Hi Krishna,

If you really want help on Elasticsearch queries it would be best to ask a question in that section of this forum.

Did you try doing the query you need in Discover?

Regards,
Lee

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