# What would be the "best" (optimal?) strategy to strip html links (hyperlinks) from string fields?

**URL:** <https://discuss.elastic.co/t/what-would-be-the-best-optimal-strategy-to-strip-html-links-hyperlinks-from-string-fields/20127>\
**Category:** Elasticsearch\
**Created:** [October 7, 2014, 9:03pm UTC](https://discuss.elastic.co/t/what-would-be-the-best-optimal-strategy-to-strip-html-links-hyperlinks-from-string-fields/20127 "2014-10-07T21:03:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hermano\_Cabral](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hermano_cabral/32/1219_2.png) [@Hermano\_Cabral](https://discuss.elastic.co/u/Hermano_Cabral)\
**Post date:** [October 7, 2014, 9:03pm UTC](https://discuss.elastic.co/t/what-would-be-the-best-optimal-strategy-to-strip-html-links-hyperlinks-from-string-fields/20127/1 "2014-10-07T21:03:29Z")

</div>

Howdy,

What would be the "best" way to strip hyperlinks (eg. [http://google.com](http://google.com),  
[www.facebook.com](http://www.facebook.com), etc.) and avoid them being analyzed? So far I've been  
using the _pattern\_replace_ char filter with reasonable success, but the  
regex is getting quite big/complex to handle all the edge cases and even  
tho we're still experimenting with ES, I'm starting to worry about the  
performance impact of doing this when we start to ingest large volumes of  
data into our ES cluster. Would the _pattern\_replace_ token filter be a  
better option here?

Cheers!

--  
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/e1ba63a2-c8c1-4c65-811d-40c6b70fefd1%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e1ba63a2-c8c1-4c65-811d-40c6b70fefd1%40googlegroups.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:** [October 7, 2014, 9:05pm UTC](https://discuss.elastic.co/t/what-would-be-the-best-optimal-strategy-to-strip-html-links-hyperlinks-from-string-fields/20127/2 "2014-10-07T21:05:54Z")

</div>

I do all my HTML munging in the application that sends data to  
Elasticsearch. I know that isn't much help, but it does work.

On Tue, Oct 7, 2014 at 5:03 PM, Hermano Cabral \<  
hermanocabral@creactive.com.br\> wrote:

> Howdy,
> 
> What would be the "best" way to strip hyperlinks (eg. [http://google.com](http://google.com),  
> [www.facebook.com](http://www.facebook.com), etc.) and avoid them being analyzed? So far I've been  
> using the _pattern\_replace_ char filter with reasonable success, but the  
> regex is getting quite big/complex to handle all the edge cases and even  
> tho we're still experimenting with ES, I'm starting to worry about the  
> performance impact of doing this when we start to ingest large volumes of  
> data into our ES cluster. Would the _pattern\_replace_ token filter be a  
> better option here?
> 
> Cheers!
> 
> --  
> 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/e1ba63a2-c8c1-4c65-811d-40c6b70fefd1%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e1ba63a2-c8c1-4c65-811d-40c6b70fefd1%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/e1ba63a2-c8c1-4c65-811d-40c6b70fefd1%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/e1ba63a2-c8c1-4c65-811d-40c6b70fefd1%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/CAPmjWd1Y\_9C-R3cwv6P8kO36%3DOyGG0DnhJoLUv0LiaqyAEKb3Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd1Y_9C-R3cwv6P8kO36%3DOyGG0DnhJoLUv0LiaqyAEKb3Q%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Hermano\_Cabral](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hermano_cabral/32/1219_2.png) [@Hermano\_Cabral](https://discuss.elastic.co/u/Hermano_Cabral)\
**Post date:** [October 7, 2014, 9:48pm UTC](https://discuss.elastic.co/t/what-would-be-the-best-optimal-strategy-to-strip-html-links-hyperlinks-from-string-fields/20127/3 "2014-10-07T21:48:14Z")

</div>

Yeah, thanks for the idea but unfortunately that's not really an option for  
me as I have no control over how the data gets sent to ES.

On Tue, Oct 7, 2014 at 6:05 PM, Nikolas Everett [nik9000@gmail.com](mailto:nik9000@gmail.com) wrote:

> I do all my HTML munging in the application that sends data to  
> Elasticsearch. I know that isn't much help, but it does work.
> 
> On Tue, Oct 7, 2014 at 5:03 PM, Hermano Cabral \<  
> hermanocabral@creactive.com.br\> wrote:
> 
> > Howdy,
> > 
> > What would be the "best" way to strip hyperlinks (eg. [http://google.com](http://google.com),  
> > [www.facebook.com](http://www.facebook.com), etc.) and avoid them being analyzed? So far I've been  
> > using the _pattern\_replace_ char filter with reasonable success, but the  
> > regex is getting quite big/complex to handle all the edge cases and even  
> > tho we're still experimenting with ES, I'm starting to worry about the  
> > performance impact of doing this when we start to ingest large volumes of  
> > data into our ES cluster. Would the _pattern\_replace_ token filter be a  
> > better option here?
> > 
> > Cheers!
> > 
> > --  
> > 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/e1ba63a2-c8c1-4c65-811d-40c6b70fefd1%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e1ba63a2-c8c1-4c65-811d-40c6b70fefd1%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/e1ba63a2-c8c1-4c65-811d-40c6b70fefd1%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/e1ba63a2-c8c1-4c65-811d-40c6b70fefd1%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/CAPmjWd1Y\_9C-R3cwv6P8kO36%3DOyGG0DnhJoLUv0LiaqyAEKb3Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd1Y_9C-R3cwv6P8kO36%3DOyGG0DnhJoLUv0LiaqyAEKb3Q%40mail.gmail.com)  
> [https://groups.google.com/d/msgid/elasticsearch/CAPmjWd1Y\_9C-R3cwv6P8kO36%3DOyGG0DnhJoLUv0LiaqyAEKb3Q%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd1Y_9C-R3cwv6P8kO36%3DOyGG0DnhJoLUv0LiaqyAEKb3Q%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/CAE%2BD6X%3DigVS42\_XxP2ptW%3D2qqzF%2BjLrYkd-tJNd%3D9TrHHfZ5sA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAE%2BD6X%3DigVS42_XxP2ptW%3D2qqzF%2BjLrYkd-tJNd%3D9TrHHfZ5sA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Hermano\_Cabral](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hermano_cabral/32/1219_2.png) [@Hermano\_Cabral](https://discuss.elastic.co/u/Hermano_Cabral)\
**Post date:** [October 9, 2014, 3:05pm UTC](https://discuss.elastic.co/t/what-would-be-the-best-optimal-strategy-to-strip-html-links-hyperlinks-from-string-fields/20127/4 "2014-10-09T15:05:44Z")

</div>

Anyone?

On Tue, Oct 7, 2014 at 6:48 PM, Hermano Cabral \<  
hermanocabral@creactive.com.br\> wrote:

> Yeah, thanks for the idea but unfortunately that's not really an option  
> for me as I have no control over how the data gets sent to ES.
> 
> On Tue, Oct 7, 2014 at 6:05 PM, Nikolas Everett [nik9000@gmail.com](mailto:nik9000@gmail.com) wrote:
> 
> > I do all my HTML munging in the application that sends data to  
> > Elasticsearch. I know that isn't much help, but it does work.
> > 
> > On Tue, Oct 7, 2014 at 5:03 PM, Hermano Cabral \<  
> > hermanocabral@creactive.com.br\> wrote:
> > 
> > > Howdy,
> > > 
> > > What would be the "best" way to strip hyperlinks (eg. [http://google.com](http://google.com),  
> > > [www.facebook.com](http://www.facebook.com), etc.) and avoid them being analyzed? So far I've been  
> > > using the _pattern\_replace_ char filter with reasonable success, but  
> > > the regex is getting quite big/complex to handle all the edge cases and  
> > > even tho we're still experimenting with ES, I'm starting to worry about the  
> > > performance impact of doing this when we start to ingest large volumes of  
> > > data into our ES cluster. Would the _pattern\_replace_ token filter be  
> > > a better option here?
> > > 
> > > Cheers!
> > > 
> > > --  
> > > 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/e1ba63a2-c8c1-4c65-811d-40c6b70fefd1%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e1ba63a2-c8c1-4c65-811d-40c6b70fefd1%40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/e1ba63a2-c8c1-4c65-811d-40c6b70fefd1%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/e1ba63a2-c8c1-4c65-811d-40c6b70fefd1%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/CAPmjWd1Y\_9C-R3cwv6P8kO36%3DOyGG0DnhJoLUv0LiaqyAEKb3Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd1Y_9C-R3cwv6P8kO36%3DOyGG0DnhJoLUv0LiaqyAEKb3Q%40mail.gmail.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/CAPmjWd1Y\_9C-R3cwv6P8kO36%3DOyGG0DnhJoLUv0LiaqyAEKb3Q%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd1Y_9C-R3cwv6P8kO36%3DOyGG0DnhJoLUv0LiaqyAEKb3Q%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/CAE%2BD6XkLz-d%2BBZybbh6%2Bp%3D-2rWsqkavFC0ogQh0qeFTBXzxyww%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAE%2BD6XkLz-d%2BBZybbh6%2Bp%3D-2rWsqkavFC0ogQh0qeFTBXzxyww%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, 12:57am UTC](https://discuss.elastic.co/t/what-would-be-the-best-optimal-strategy-to-strip-html-links-hyperlinks-from-string-fields/20127/5 "2017-07-06T00:57:15Z")

</div>


