# How to replicate this type of search

**URL:** <https://discuss.elastic.co/t/how-to-replicate-this-type-of-search/23507>\
**Category:** Elasticsearch\
**Created:** [April 30, 2015, 11:22pm UTC](https://discuss.elastic.co/t/how-to-replicate-this-type-of-search/23507 "2015-04-30T23:22:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_Sorensen](https://avatars.discourse-cdn.com/v4/letter/p/dc4da7/32.png) [@Peter\_Sorensen](https://discuss.elastic.co/u/Peter_Sorensen)\
**Post date:** [April 30, 2015, 11:22pm UTC](https://discuss.elastic.co/t/how-to-replicate-this-type-of-search/23507/1 "2015-04-30T23:22:10Z")

</div>

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](mailto: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).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jveldboom](https://avatars.discourse-cdn.com/v4/letter/j/f1d935/32.png) [@jveldboom](https://discuss.elastic.co/u/jveldboom)\
**Post date:** [May 1, 2015, 1:07am UTC](https://discuss.elastic.co/t/how-to-replicate-this-type-of-search/23507/2 "2015-05-01T01:07:43Z")

</div>

Hey Peter,

They're likely using a filtered query  
[http://www.elastic.co/guide/en/elasticsearch/reference/1.5/query-dsl-filtered-query.html](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](mailto: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](https://groups.google.com/d/msgid/elasticsearch/4b9df802-5197-45b5-987a-7c7e480b6d7f%40googlegroups.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:** [May 1, 2015, 4:50am UTC](https://discuss.elastic.co/t/how-to-replicate-this-type-of-search/23507/3 "2015-05-01T04:50:48Z")

</div>

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](mailto: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](mailto: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)  
> [https://groups.google.com/d/msgid/elasticsearch/856fd1f6-e8eb-460b-abf5-ca70eb10a22f%40googlegroups.com?utm\_medium=email&utm\_source=footer](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](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%3DcQC0Zkfwsy7JKuvVmRwJE8HuHRWU\_%2BzZGtf%2BdjYAejMPEQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQC0Zkfwsy7JKuvVmRwJE8HuHRWU_%2BzZGtf%2BdjYAejMPEQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Peter\_Sorensen](https://avatars.discourse-cdn.com/v4/letter/p/dc4da7/32.png) [@Peter\_Sorensen](https://discuss.elastic.co/u/Peter_Sorensen)\
**Post date:** [May 1, 2015, 3:26pm UTC](https://discuss.elastic.co/t/how-to-replicate-this-type-of-search/23507/4 "2015-05-01T15:26:38Z")

</div>

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](mailto: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](https://groups.google.com/d/msgid/elasticsearch/e8ad15f1-61bf-4f65-a061-ecfe784b62f8%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jveldboom](https://avatars.discourse-cdn.com/v4/letter/j/f1d935/32.png) [@jveldboom](https://discuss.elastic.co/u/jveldboom)\
**Post date:** [May 1, 2015, 3:36pm UTC](https://discuss.elastic.co/t/how-to-replicate-this-type-of-search/23507/5 "2015-05-01T15:36:09Z")

</div>

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](mailto: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](https://groups.google.com/d/msgid/elasticsearch/dbf03829-7675-41f2-ae5d-274e246a5fc8%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Peter\_Sorensen](https://avatars.discourse-cdn.com/v4/letter/p/dc4da7/32.png) [@Peter\_Sorensen](https://discuss.elastic.co/u/Peter_Sorensen)\
**Post date:** [May 1, 2015, 3:55pm UTC](https://discuss.elastic.co/t/how-to-replicate-this-type-of-search/23507/6 "2015-05-01T15:55:47Z")

</div>

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](mailto: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](https://groups.google.com/d/msgid/elasticsearch/b78e9ef6-1d15-47d2-ab04-7aceab61aeef%40googlegroups.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, 12:16am UTC](https://discuss.elastic.co/t/how-to-replicate-this-type-of-search/23507/7 "2017-07-06T00:16:14Z")

</div>


