# Multi-word Term Vectors with Word nGrams?

**URL:** <https://discuss.elastic.co/t/multi-word-term-vectors-with-word-ngrams/21112>\
**Category:** Elasticsearch\
**Created:** [December 5, 2014, 5:43pm UTC](https://discuss.elastic.co/t/multi-word-term-vectors-with-word-ngrams/21112 "2014-12-05T17:43:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam\_Toy](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@Adam\_Toy](https://discuss.elastic.co/u/Adam_Toy)\
**Post date:** [December 5, 2014, 5:43pm UTC](https://discuss.elastic.co/t/multi-word-term-vectors-with-word-ngrams/21112/1 "2014-12-05T17:43:57Z")

</div>

Hi all,

I'm aiming to build an index that, for each document, will break it down by  
word ngrams (uni, bi, and tri), then capture term vector analysis on all of  
those word ngrams. Is that possible with Elasticsearch?

For instance, for a document field containing "The car drives." I would be  
able to get:

the - 1 instance  
car - 1 instance  
drives - 1 instance  
the car - 1 instance  
car drives - 1 instance  
the car drives - 1 instance

Thanks in advance!

--  
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/23db3079-0475-4a63-bc77-e514bf087359%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/23db3079-0475-4a63-bc77-e514bf087359%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Adam\_Toy](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@Adam\_Toy](https://discuss.elastic.co/u/Adam_Toy)\
**Post date:** [December 9, 2014, 7:26pm UTC](https://discuss.elastic.co/t/multi-word-term-vectors-with-word-ngrams/21112/2 "2014-12-09T19:26:12Z")

</div>

Bump.

Also, need to correct my original example as 'The red car drives':

red  
car  
drives  
red car  
car drives  
red car drives

On Friday, December 5, 2014 12:43:57 PM UTC-5, Adam Toy wrote:

> Hi all,
> 
> I'm aiming to build an index that, for each document, will break it down  
> by word ngrams (uni, bi, and tri), then capture term vector analysis on all  
> of those word ngrams. Is that possible with Elasticsearch?
> 
> For instance, for a document field containing "The car drives." I would be  
> able to get:
> 
> the - 1 instance  
> car - 1 instance  
> drives - 1 instance  
> the car - 1 instance  
> car drives - 1 instance  
> the car drives - 1 instance
> 
> Thanks in advance!

--  
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/b2841818-5996-4108-8468-c585c849c11b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b2841818-5996-4108-8468-c585c849c11b%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![softwaredoug](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/softwaredoug/32/22681_2.png) [@softwaredoug](https://discuss.elastic.co/u/softwaredoug)\
**Post date:** [December 10, 2014, 1:29am UTC](https://discuss.elastic.co/t/multi-word-term-vectors-with-word-ngrams/21112/3 "2014-12-10T01:29:09Z")

</div>

Adam,

Have you seen the Shingle Filter?

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

Use as part of a custom analyzer, (you probably want to lowercase as well)

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

In Lucene-based search (ie Elasticsearch/Solr) "ngram" means character  
ngrams. Like "red" =\> "r", "re", "red". What most folks think of as  
"ngrams" Lucene calls "shingles".

Hope that helps  
-Doug

On Tue, Dec 9, 2014 at 2:26 PM, Adam Toy [art62@georgetown.edu](mailto:art62@georgetown.edu) wrote:

> Bump.
> 
> Also, need to correct my original example as 'The red car drives':
> 
> red  
> car  
> drives  
> red car  
> car drives  
> red car drives
> 
> On Friday, December 5, 2014 12:43:57 PM UTC-5, Adam Toy wrote:
> 
> > Hi all,
> > 
> > I'm aiming to build an index that, for each document, will break it down  
> > by word ngrams (uni, bi, and tri), then capture term vector analysis on all  
> > of those word ngrams. Is that possible with Elasticsearch?
> > 
> > For instance, for a document field containing "The car drives." I would  
> > be able to get:
> > 
> > the - 1 instance  
> > car - 1 instance  
> > drives - 1 instance  
> > the car - 1 instance  
> > car drives - 1 instance  
> > the car drives - 1 instance
> > 
> > Thanks in advance!
> 
> --  
> 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/b2841818-5996-4108-8468-c585c849c11b%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b2841818-5996-4108-8468-c585c849c11b%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/b2841818-5996-4108-8468-c585c849c11b%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/b2841818-5996-4108-8468-c585c849c11b%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Doug Turnbull  
Search & Big Data Architect  
OpenSource Connections [http://o19s.com](http://o19s.com)

--  
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/CALG6HL\_dZVLiYNaRM%3DH844BFGbbATYweXCn-OE%2BL-ioo%3D3moOw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALG6HL_dZVLiYNaRM%3DH844BFGbbATYweXCn-OE%2BL-ioo%3D3moOw%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:44am UTC](https://discuss.elastic.co/t/multi-word-term-vectors-with-word-ngrams/21112/4 "2017-07-06T00:44:36Z")

</div>


