# Is is possible to use different query languages (such as lucene, script, ..) in a search?

**URL:** <https://discuss.elastic.co/t/is-is-possible-to-use-different-query-languages-such-as-lucene-script-in-a-search/170484>\
**Category:** Elasticsearch\
**Created:** [March 1, 2019, 10:57am UTC](https://discuss.elastic.co/t/is-is-possible-to-use-different-query-languages-such-as-lucene-script-in-a-search/170484 "2019-03-01T10:57:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![caub](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/caub/32/33783_2.png) [@caub](https://discuss.elastic.co/u/caub)\
**Post date:** [March 1, 2019, 10:57am UTC](https://discuss.elastic.co/t/is-is-possible-to-use-different-query-languages-such-as-lucene-script-in-a-search/170484/1 "2019-03-01T10:57:49Z")

</div>

example:

```auto
GET filebeat*/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "stream": "stderr"
          }
        },
        {
          "range": {
            "@timestamp": {
              "gte": "now-24h"
            }
          }
        }
      ],
      "must_not": [
        {
           "q": "message:Foo+Bar",
           "language": "lucene"
         }
      ]
    }
  }
}

```

Would something like this be possible?

I know I could convert this lucene syntax in the ES Query DSL, but I'd like to use several queries defined in Lucene syntax, programmatically

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 1, 2019, 11:13am UTC](https://discuss.elastic.co/t/is-is-possible-to-use-different-query-languages-such-as-lucene-script-in-a-search/170484/2 "2019-03-01T11:13:56Z")

</div>

The query string query uses a Lucene syntax if this is what you are looking for.

---

<div class="post-metadata">

**Author:** ![caub](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/caub/32/33783_2.png) [@caub](https://discuss.elastic.co/u/caub)\
**Post date:** [March 1, 2019, 11:19am UTC](https://discuss.elastic.co/t/is-is-possible-to-use-different-query-languages-such-as-lucene-script-in-a-search/170484/3 "2019-03-01T11:19:46Z")

</div>

Thanks, yes I know I can do ?q=message:Foo+Bar as query string, but I'd like to wrap multiple lucene searches inside a bigger query like above

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 1, 2019, 11:32am UTC](https://discuss.elastic.co/t/is-is-possible-to-use-different-query-languages-such-as-lucene-script-in-a-search/170484/4 "2019-03-01T11:32:22Z")

</div>

Not sure if I got your question right but this?

```auto
GET /_search
{
    "query": {
        "query_string" : {
            "query" : "message:Foo+Bar"
        }
    }
}

```

Based on doc here: [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html)

---

<div class="post-metadata">

**Author:** ![caub](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/caub/32/33783_2.png) [@caub](https://discuss.elastic.co/u/caub)\
**Post date:** [March 1, 2019, 11:47am UTC](https://discuss.elastic.co/t/is-is-possible-to-use-different-query-languages-such-as-lucene-script-in-a-search/170484/5 "2019-03-01T11:47:14Z")

</div>

Wow, thanks, that's what I needed

---

<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:** [March 29, 2019, 11:47am UTC](https://discuss.elastic.co/t/is-is-possible-to-use-different-query-languages-such-as-lucene-script-in-a-search/170484/6 "2019-03-29T11:47:15Z")

</div>

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