# Elastic Search Filter

**URL:** https://discuss.elastic.co/t/elastic-search-filter/160234
**Category:** Elasticsearch
**Created:** [December 10, 2018, 6:53pm UTC](https://discuss.elastic.co/t/elastic-search-filter/160234 "2018-12-10T18:53:14Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![anveshdd](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@anveshdd](https://discuss.elastic.co/u/anveshdd)
#### Post date: [December 10, 2018, 6:53pm UTC](https://discuss.elastic.co/t/elastic-search-filter/160234/1 "2018-12-10T18:53:14Z")

</div>

Working on Elastic Search 6.5.x. I indexed the documents into ES index via external web crawler. Below is my Index. I want to get the records based on the filter. If I use the below query, Suppose if I use term query by **https** the http results are not displaying same for the **http**. How can I compare records of an URL field after the protocol. If it has same info how can I display either one of the record with remaining unique records.

**Index:**

```
"title": "About elastic search"
"content": "Elasticsearch is an open source distributed, RESTful search and analytics engine capable of solving a growing number of use cases."
"URL: "https://www.elastic.co/webinars/getting-started-elasticsearch"`

"title":"About elastic search"
"content":"Elasticsearch is an open source distributed, RESTful search and analytics engine capable of solving a growing number of use cases."
"URL":"http://www.elastic.co/webinars/getting-started-elasticsearch"

"title":"About Similarity"
"content":"A similarity (scoring / ranking model) defines how matching documents are scored. Similarity is per field, meaning that via the mapping one can define a different similarity per field."
"URL":"https://www.elastic.co/guide/en/elasticsearch/reference/6.2/index-modules-similarity.html"

"title":"SQL Access"
"content":"This functionality is experimental and may be changed or removed completely in a future release. Elastic will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features."
"URL":"http://www.elastic.co/guide/en/elasticsearch/reference/current/xpack-sql.html"

```

**Query:**

```
GET test-index/_search
{
   "query":{
      "bool":{
         "must":{
            "query_string":{
               "query":"test"
            }
         },
         "filter": {  
             "bool" : {
                 "must" : 
                    {"term" : { "url" : "https" } }
               }}
      }
   }
}
```

---

<div class="post-metadata">

### Author: ![zz\_hello](https://avatars.discourse-cdn.com/v4/letter/z/3bc359/32.png) [@zz\_hello](https://discuss.elastic.co/u/zz_hello)
#### Post date: [December 11, 2018, 2:57am UTC](https://discuss.elastic.co/t/elastic-search-filter/160234/2 "2018-12-11T02:57:19Z")

</div>

maybe this link will help you. you can omit the protocol by the tokenfilter.  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-pattern-capture-tokenfilter.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-pattern-capture-tokenfilter.html)

---

<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: [January 8, 2019, 2:57am UTC](https://discuss.elastic.co/t/elastic-search-filter/160234/3 "2019-01-08T02:57:23Z")

</div>

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