How to replicate this type of search


(Peter Sorensen) #1

Sorry for the vague title. If I knew what to call what I was looking for,
I'd have a much easier time finding it!

Anyways, I often see sites using filters right in the query box. For
instance, on Github, you can see open issues by typing is:open: is:issue {search term}

What element of ES is used to perform this?

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/856fd1f6-e8eb-460b-abf5-ca70eb10a22f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(John Veldboom) #2

Hey Peter,

They're likely using a filtered query
http://www.elastic.co/guide/en/elasticsearch/reference/1.5/query-dsl-filtered-query.html.
Maybe on a "status" field for the "is:open" and a "type" field for the
"is:issue".

It could look something like this:

{
"query":{
"filtered":{
"query":{
"multi_match":{
"query":"search term",
"fields":[
"title",
"body",
"tags"
]
}
}
},
"filter":{
"and":{
"filters":[
{
"term":{
"status":"open"
}
},
{
"terms":{
"type":"issue"
}
}
]
}
}
}
}

On Thursday, April 30, 2015 at 7:22:11 PM UTC-4, Peter Sorensen wrote:

Sorry for the vague title. If I knew what to call what I was looking for,
I'd have a much easier time finding it!

Anyways, I often see sites using filters right in the query box. For
instance, on Github, you can see open issues by typing is:open: is:issue {search term}

What element of ES is used to perform this?

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4b9df802-5197-45b5-987a-7c7e480b6d7f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Ivan Brusic) #3

Although the syntax is straight Lucene (query string query), I suspect that
Github and other sites parse the query term to create a format similar to
the one John mentioned.

Cheers,

Ivan
On May 1, 2015 1:22 AM, "Peter Sorensen" peter.jens.sorensen@gmail.com
wrote:

Sorry for the vague title. If I knew what to call what I was looking for,
I'd have a much easier time finding it!

Anyways, I often see sites using filters right in the query box. For
instance, on Github, you can see open issues by typing is:open: is:issue {search term}

What element of ES is used to perform this?

--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/856fd1f6-e8eb-460b-abf5-ca70eb10a22f%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/856fd1f6-e8eb-460b-abf5-ca70eb10a22f%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit 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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC0Zkfwsy7JKuvVmRwJE8HuHRWU_%2BzZGtf%2BdjYAejMPEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(Peter Sorensen) #4

Thanks John & Ivan for your insight. Very helpful. Just to see if I'm
getting this:

In order to have a search where my users can type "title: {query term}" to
limit the search only to titles, I need to program my application to parse
the query string and then add the additional filters to the ES request. Do
I have this right?

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e8ad15f1-61bf-4f65-a061-ecfe784b62f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(John Veldboom) #5

Yes, that's correct.

Depending on your application, it might be easier to have the filters as a
dropdown. Similar how sites like Amazon allow you to choose which
department to search within. Otherwise you'll have to rely on your users to
type in the correct syntax - which might be what you want to allow more
flexibility.

On Friday, May 1, 2015 at 11:26:38 AM UTC-4, Peter Sorensen wrote:

Thanks John & Ivan for your insight. Very helpful. Just to see if I'm
getting this:

In order to have a search where my users can type "title: {query term}" to
limit the search only to titles, I need to program my application to parse
the query string and then add the additional filters to the ES request. Do
I have this right?

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/dbf03829-7675-41f2-ae5d-274e246a5fc8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Peter Sorensen) #6

Thanks John! It's all very clear now.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b78e9ef6-1d15-47d2-ab04-7aceab61aeef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #7