# Elastic search extracts text inside title attribute of anchor tags while adding pdf attachment

**URL:** https://discuss.elastic.co/t/elastic-search-extracts-text-inside-title-attribute-of-anchor-tags-while-adding-pdf-attachment/204255
**Category:** Elasticsearch
**Created:** [October 18, 2019, 4:41pm UTC](https://discuss.elastic.co/t/elastic-search-extracts-text-inside-title-attribute-of-anchor-tags-while-adding-pdf-attachment/204255 "2019-10-18T16:41:25Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![sandeepv](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeepv/32/59111_2.png) [@sandeepv](https://discuss.elastic.co/u/sandeepv)
#### Post date: [October 18, 2019, 4:41pm UTC](https://discuss.elastic.co/t/elastic-search-extracts-text-inside-title-attribute-of-anchor-tags-while-adding-pdf-attachment/204255/1 "2019-10-18T16:41:25Z")

</div>

I have added a base64 encoded pdf file with pipeline= attachment using kibana into Elasticsearch

when i queried the pdf with highlights i got the below result

> _dan_@_[1abmedia.com](http://1abmedia.com)_
> 
> [https://www.globenewswire.com/Tracker?data=D3\_Gb2rHO0RJs5ptt\_YaxhbTrJp2no3K1iZwzpAcG4YENDUM1UZ9wuY6DcxpQ5h0Se8zNYREibjVPWmQf024bA==](https://www.globenewswire.com/Tracker?data=D3_Gb2rHO0RJs5ptt_YaxhbTrJp2no3K1iZwzpAcG4YENDUM1UZ9wuY6DcxpQ5h0Se8zNYREibjVPWmQf024bA==)

The url inside the highlights is actually the href of the anchor tag and the same is in the title attribute.

When i added the pdf into eastic search its also indexes the title attributes value is there any way to avoid considering the tooltips .

When i viewed the pdf file by id the content also contains the url.

Does any one know how to avoid this and index only the text part between the html tags and ignore the text inside the html tag's attribute value.

Please help...

---

<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: [October 18, 2019, 5:32pm UTC](https://discuss.elastic.co/t/elastic-search-extracts-text-inside-title-attribute-of-anchor-tags-while-adding-pdf-attachment/204255/2 "2019-10-18T17:32:04Z")

</div>

I'm wondering if you are looking for [https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-htmlstrip-charfilter.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-htmlstrip-charfilter.html) ?

---

<div class="post-metadata">

### Author: ![sandeepv](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sandeepv/32/59111_2.png) [@sandeepv](https://discuss.elastic.co/u/sandeepv)
#### Post date: [October 19, 2019, 12:02pm UTC](https://discuss.elastic.co/t/elastic-search-extracts-text-inside-title-attribute-of-anchor-tags-while-adding-pdf-attachment/204255/3 "2019-10-19T12:02:55Z")

</div>

Thanks for you reply @dadoonet. But how do i apply to the below data..?  
Below is the put request to add pdf file using pipeline=attachment

```
PUT pdf/_doc/1?pipeline=attachment
{
  "data": "base64 encoded string"
}

```

[link to the pdf file](https://drive.google.com/file/d/1iKxwFiJ0g0QThXYT5Lj_tgeBGsWLkwjG/view)

Please try adding the pdf file attached after converting it to base64 and then search for  
[dan@1abmedia.com](mailto:dan@1abmedia.com) using the below request

```
GET /pdf/_search
{
  "_source": false,
  "from":0,
  "size":20,
  "query": {
    "query_string": {
      "query": "dan@1abmedia.com"
    }
  },
  "highlight": {
    "fields": {
      "content": {
        "type": "plain",
        "fragment_size": 500,
        "number_of_fragments": 1
      },
      "attachment.content": {
        "fragment_size": 500,
        "number_of_fragments": 1,
        "type": "plain"
      },
      "attachment.title": {
        "fragment_size": 500,
        "number_of_fragments": 1,
        "type": "unified"
      }
    }
  }
}

```

Response:

```
"hits" : {
    "total" : {
      "value" : 2,
      "relation" : "eq"
    },
    "max_score" : 3.0848434,
    "hits" : [      
      {
        "_index" : "pdf",
        "_type" : "_doc",
        "_id" : "1",
        "_score" : 0.68484235,
        "highlight" : {
          "attachment.content" : [
            """
 of the company in general, see Gritstone’s most recent Quarterly Report on Form 10-Q filed on August 12, 2019
and any current and periodic reports filed with the Securities and Exchange Commission.

Contacts
Media:
<em>Dan</em> Budwick
1AB
xxxxxxxxxxxx
<em>dan</em>@<em>1abmedia.com</em>

https://www.globenewswire.com/Tracker?data=D3_Gb2rHO0RJs5ptt_YaxhbTrJp2no3K1iZwzpAcG4YENDUM1UZ9wuY6DcxpQ5h0Se8zNYREibjVPWmQf024bA==

Investors:
Alexandra Santos
Wheelhouse Life Science Advisors
xxxxxxxxxx
xxxxxx@xxxxxx.com
"""
          ]
        }
      }
    ]
  }
}

```

There is a url appearing in the above search result its actually a tooltip of a link _[dan@1abmedia.com](mailto:dan@1abmedia.com)_ it should not show up in the highlights

Elastic search is indexing the text inside the title attribute's value, i want to get avoid that is there any way to do it.

Any help would be greatly appreciated.

Thanks.

---

<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: [October 19, 2019, 1:59pm UTC](https://discuss.elastic.co/t/elastic-search-extracts-text-inside-title-attribute-of-anchor-tags-while-adding-pdf-attachment/204255/4 "2019-10-19T13:59:40Z")

</div>

I see. I can't think of any workaround.  
You could may be add in your pipeline a [gsub processor](https://www.elastic.co/guide/en/elasticsearch/reference/current/gsub-processor.html) which removes all `http` strings.... But that's not what you are looking for here.

---

<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: [November 16, 2019, 1:59pm UTC](https://discuss.elastic.co/t/elastic-search-extracts-text-inside-title-attribute-of-anchor-tags-while-adding-pdf-attachment/204255/5 "2019-11-16T13:59:43Z")

</div>

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