# Github issues search query DSL

**URL:** https://discuss.elastic.co/t/github-issues-search-query-dsl/19239
**Category:** Elasticsearch
**Created:** [August 12, 2014, 5:32pm UTC](https://discuss.elastic.co/t/github-issues-search-query-dsl/19239 "2014-08-12T17:32:54Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Erik\_Paulson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/erik_paulson/32/1341_2.png) [@Erik\_Paulson](https://discuss.elastic.co/u/Erik_Paulson)
#### Post date: [August 12, 2014, 5:32pm UTC](https://discuss.elastic.co/t/github-issues-search-query-dsl/19239/1 "2014-08-12T17:32:54Z")

</div>

Hello -

Github has a pretty slick search interface for issues, complete with a set  
of qualifiers that users can stick onto their free-form text queries.  
They're using ES for their code search, and I'm guessing for their issues  
as well:

[https://help.github.com/articles/searching-issues](https://help.github.com/articles/searching-issues)

Is there a good library or example code somewhere that implements a similar  
query language? Obviously some qualifiers are github-specific, but other  
operators are more generic (in: is:, the quantified operators, etc)

I'm building a search interface for some data and documents with the  
interface nothing more than a single search bar - basically, starting with  
something like Calaca. My users aren't going to write ES queries directly,  
but the power users could use qualifiers. Obviously, this isn't exactly  
rocket science, but if there's a good example of a simple web frontend that  
parses a simple query DSL and converts it into an ES search, I'd love to  
use that rather than reinventing the wheel. Any language on the backend is  
really fine, I'm not attached to anything yet so if there was Ruby or  
Python or really whatever, it's fine by me.

Thanks for any pointers you might have!

-Erik

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAKJO4n7VenJC7dj1wU3bx4BJw8UL4GRiBwzht1Uma0V3-Vwkng%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKJO4n7VenJC7dj1wU3bx4BJw8UL4GRiBwzht1Uma0V3-Vwkng%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)
#### Post date: [August 12, 2014, 5:39pm UTC](https://discuss.elastic.co/t/github-issues-search-query-dsl/19239/2 "2014-08-12T17:39:51Z")

</div>

Look into the Lucene query parser, which its the syntax that the query  
string query uses. After that, look into the various Lucene contrib modules  
that extend the query syntax (span near is one).

I do not think that anyone has implemented a new query parser as an  
elasticsearch plugin yet, but I could be wrong.

Cheers,

Ivan  
On Aug 12, 2014 1:33 PM, "Erik Paulson" [epaulson@unit1127.com](mailto:epaulson@unit1127.com) wrote:

> Hello -
> 
> Github has a pretty slick search interface for issues, complete with a set  
> of qualifiers that users can stick onto their free-form text queries.  
> They're using ES for their code search, and I'm guessing for their issues  
> as well:
> 
> [Searching issues and pull requests - GitHub Docs](https://help.github.com/articles/searching-issues)
> 
> Is there a good library or example code somewhere that implements a  
> similar query language? Obviously some qualifiers are github-specific, but  
> other operators are more generic (in: is:, the quantified operators, etc)
> 
> I'm building a search interface for some data and documents with the  
> interface nothing more than a single search bar - basically, starting with  
> something like Calaca. My users aren't going to write ES queries directly,  
> but the power users could use qualifiers. Obviously, this isn't exactly  
> rocket science, but if there's a good example of a simple web frontend that  
> parses a simple query DSL and converts it into an ES search, I'd love to  
> use that rather than reinventing the wheel. Any language on the backend is  
> really fine, I'm not attached to anything yet so if there was Ruby or  
> Python or really whatever, it's fine by me.
> 
> Thanks for any pointers you might have!
> 
> -Erik
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAKJO4n7VenJC7dj1wU3bx4BJw8UL4GRiBwzht1Uma0V3-Vwkng%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKJO4n7VenJC7dj1wU3bx4BJw8UL4GRiBwzht1Uma0V3-Vwkng%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAKJO4n7VenJC7dj1wU3bx4BJw8UL4GRiBwzht1Uma0V3-Vwkng%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAKJO4n7VenJC7dj1wU3bx4BJw8UL4GRiBwzht1Uma0V3-Vwkng%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBCXHPtLuyWRbCw37\_N7u4nBR\_i6EKEd3cLpM%2B-0pW8gg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBCXHPtLuyWRbCw37_N7u4nBR_i6EKEd3cLpM%2B-0pW8gg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)
#### Post date: [August 12, 2014, 6:04pm UTC](https://discuss.elastic.co/t/github-issues-search-query-dsl/19239/3 "2014-08-12T18:04:19Z")

</div>

I'd implement the query parser in your application and then build a the  
queries and send then to Elasticsearch. The advantage of that is that you  
don't have to bounce all the Elasticsearch nodes when you upgrade your  
query language. Its what we did. Our code isn't elegant or pretty or  
anything - just regexes pulling expect syntax out of the query string and  
then slapping it into filters and stuff. Its not super hard if you do it  
that way. I'd link you to the code but its so ugly I don't advocate using  
it as a starting point.

One thing, though: this is something you really really really should have  
integration tests for. Like all the way from your application's external  
API to Elasticsearch. Without it its pretty easy to break stuff.

Nik

On Tue, Aug 12, 2014 at 1:39 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> Look into the Lucene query parser, which its the syntax that the query  
> string query uses. After that, look into the various Lucene contrib modules  
> that extend the query syntax (span near is one).
> 
> I do not think that anyone has implemented a new query parser as an  
> elasticsearch plugin yet, but I could be wrong.
> 
> Cheers,
> 
> Ivan  
> On Aug 12, 2014 1:33 PM, "Erik Paulson" [epaulson@unit1127.com](mailto:epaulson@unit1127.com) wrote:
> 
> > Hello -
> > 
> > Github has a pretty slick search interface for issues, complete with a  
> > set of qualifiers that users can stick onto their free-form text queries.  
> > They're using ES for their code search, and I'm guessing for their issues  
> > as well:
> > 
> > [Searching issues and pull requests - GitHub Docs](https://help.github.com/articles/searching-issues)
> > 
> > Is there a good library or example code somewhere that implements a  
> > similar query language? Obviously some qualifiers are github-specific, but  
> > other operators are more generic (in: is:, the quantified operators, etc)
> > 
> > I'm building a search interface for some data and documents with the  
> > interface nothing more than a single search bar - basically, starting with  
> > something like Calaca. My users aren't going to write ES queries directly,  
> > but the power users could use qualifiers. Obviously, this isn't exactly  
> > rocket science, but if there's a good example of a simple web frontend that  
> > parses a simple query DSL and converts it into an ES search, I'd love to  
> > use that rather than reinventing the wheel. Any language on the backend is  
> > really fine, I'm not attached to anything yet so if there was Ruby or  
> > Python or really whatever, it's fine by me.
> > 
> > Thanks for any pointers you might have!
> > 
> > -Erik
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAKJO4n7VenJC7dj1wU3bx4BJw8UL4GRiBwzht1Uma0V3-Vwkng%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKJO4n7VenJC7dj1wU3bx4BJw8UL4GRiBwzht1Uma0V3-Vwkng%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CAKJO4n7VenJC7dj1wU3bx4BJw8UL4GRiBwzht1Uma0V3-Vwkng%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAKJO4n7VenJC7dj1wU3bx4BJw8UL4GRiBwzht1Uma0V3-Vwkng%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBCXHPtLuyWRbCw37\_N7u4nBR\_i6EKEd3cLpM%2B-0pW8gg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBCXHPtLuyWRbCw37_N7u4nBR_i6EKEd3cLpM%2B-0pW8gg%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBCXHPtLuyWRbCw37\_N7u4nBR\_i6EKEd3cLpM%2B-0pW8gg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBCXHPtLuyWRbCw37_N7u4nBR_i6EKEd3cLpM%2B-0pW8gg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAPmjWd0MezGCW%3DS%3Dd-CpgC0UZJDmHxNiOV%2BJSuPFPzn14Ov3rA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd0MezGCW%3DS%3Dd-CpgC0UZJDmHxNiOV%2BJSuPFPzn14Ov3rA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)
#### Post date: [August 12, 2014, 6:42pm UTC](https://discuss.elastic.co/t/github-issues-search-query-dsl/19239/4 "2014-08-12T18:42:49Z")

</div>

My recommendation is to use the simple\_query\_string, which is a mini  
language for itself.

Beside this, I am about completing a plugin for Contextual Query Language  
(CQL) and Search/Retrieve via URL (SRU) for bibliographic searches, which  
is very close to your question.

[https://github.com/xbib/elasticsearch-sru](https://github.com/xbib/elasticsearch-sru)

The reason is I'm connecting legacy library systems to Elasticsearch for  
very basic queries like book searches. In CQL, imagine queries like this

dc.creator = "Harriet Beecher Stowe" and dc.title = "Uncle Tom's cabin"

on docs like this

{  
"dc" : {  
"title" : "Uncle Tom's cabin",  
"creator" : "Harriet Beecher Stowe"  
}  
}

With SRU 2.0/searchRetrieve 1.0, you can even add parameters for facets =  
simple terms aggregation.

At the moment, I'm adding Handlebars templates for rendering ES  
SearchResponse to SRU XML (which is part of the legacy I have to address)

Jörg

On Tue, Aug 12, 2014 at 7:39 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> Look into the Lucene query parser, which its the syntax that the query  
> string query uses. After that, look into the various Lucene contrib modules  
> that extend the query syntax (span near is one).
> 
> I do not think that anyone has implemented a new query parser as an  
> elasticsearch plugin yet, but I could be wrong.
> 
> Cheers,
> 
> Ivan  
> On Aug 12, 2014 1:33 PM, "Erik Paulson" [epaulson@unit1127.com](mailto:epaulson@unit1127.com) wrote:
> 
> > Hello -
> > 
> > Github has a pretty slick search interface for issues, complete with a  
> > set of qualifiers that users can stick onto their free-form text queries.  
> > They're using ES for their code search, and I'm guessing for their issues  
> > as well:
> > 
> > [Searching issues and pull requests - GitHub Docs](https://help.github.com/articles/searching-issues)
> > 
> > Is there a good library or example code somewhere that implements a  
> > similar query language? Obviously some qualifiers are github-specific, but  
> > other operators are more generic (in: is:, the quantified operators, etc)
> > 
> > I'm building a search interface for some data and documents with the  
> > interface nothing more than a single search bar - basically, starting with  
> > something like Calaca. My users aren't going to write ES queries directly,  
> > but the power users could use qualifiers. Obviously, this isn't exactly  
> > rocket science, but if there's a good example of a simple web frontend that  
> > parses a simple query DSL and converts it into an ES search, I'd love to  
> > use that rather than reinventing the wheel. Any language on the backend is  
> > really fine, I'm not attached to anything yet so if there was Ruby or  
> > Python or really whatever, it's fine by me.
> > 
> > Thanks for any pointers you might have!
> > 
> > -Erik
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/CAKJO4n7VenJC7dj1wU3bx4BJw8UL4GRiBwzht1Uma0V3-Vwkng%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKJO4n7VenJC7dj1wU3bx4BJw8UL4GRiBwzht1Uma0V3-Vwkng%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CAKJO4n7VenJC7dj1wU3bx4BJw8UL4GRiBwzht1Uma0V3-Vwkng%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAKJO4n7VenJC7dj1wU3bx4BJw8UL4GRiBwzht1Uma0V3-Vwkng%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBCXHPtLuyWRbCw37\_N7u4nBR\_i6EKEd3cLpM%2B-0pW8gg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBCXHPtLuyWRbCw37_N7u4nBR_i6EKEd3cLpM%2B-0pW8gg%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBCXHPtLuyWRbCw37\_N7u4nBR\_i6EKEd3cLpM%2B-0pW8gg%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBCXHPtLuyWRbCw37_N7u4nBR_i6EKEd3cLpM%2B-0pW8gg%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAKdsXoFtwNK4MmZBNGDxz5iuW8nGczP%2B927QcATam4YBLgZJNg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoFtwNK4MmZBNGDxz5iuW8nGczP%2B927QcATam4YBLgZJNg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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: [July 6, 2017, 1:09am UTC](https://discuss.elastic.co/t/github-issues-search-query-dsl/19239/5 "2017-07-06T01:09:07Z")

</div>


