# Highlights problems with a filtered query

**URL:** <https://discuss.elastic.co/t/highlights-problems-with-a-filtered-query/4091>\
**Category:** Elasticsearch\
**Created:** [March 14, 2011, 11:30am UTC](https://discuss.elastic.co/t/highlights-problems-with-a-filtered-query/4091 "2011-03-14T11:30:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexandre\_Heimburger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexandre_heimburger/32/2941_2.png) [@Alexandre\_Heimburger](https://discuss.elastic.co/u/Alexandre_Heimburger)\
**Post date:** [March 14, 2011, 11:30am UTC](https://discuss.elastic.co/t/highlights-problems-with-a-filtered-query/4091/1 "2011-03-14T11:30:35Z")

</div>

Hi folks,

I have this query which does not highlight anything :

{"query":  
{"filtered":  
{"query": {"query\_string":  
{"default\_field":"title","default\_operator":"AND","query":"_che_"}},  
"filter": {"or":[{"term":{"locations":1}},{"term":  
{"locations":2}}]},  
"highlight":{"fields":{"title":{"fragment\_size":  
150,"number\_of\_fragments":3}}}  
}  
}  
}

The result of the query is OK but nothing is highlighted.

Thanks.

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [March 14, 2011, 3:11pm UTC](https://discuss.elastic.co/t/highlights-problems-with-a-filtered-query/4091/2 "2011-03-14T15:11:09Z")

</div>

Can you gist a full recreation? ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help)).  
On Monday, March 14, 2011 at 1:30 PM, alheim wrote:

> Hi folks,
> 
> I have this query which does not highlight anything :
> 
> {"query":  
> {"filtered":  
> {"query": {"query\_string":  
> {"default\_field":"title","default\_operator":"AND","query":"_che_"}},  
> "filter": {"or":[{"term":{"locations":1}},{"term":  
> {"locations":2}}]},  
> "highlight":{"fields":{"title":{"fragment\_size":  
> 150,"number\_of\_fragments":3}}}  
> }  
> }  
> }
> 
> The result of the query is OK but nothing is highlighted.
> 
> Thanks.

---

<div class="post-metadata">

**Author:** ![Alexandre\_Heimburger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexandre_heimburger/32/2941_2.png) [@Alexandre\_Heimburger](https://discuss.elastic.co/u/Alexandre_Heimburger)\
**Post date:** [March 14, 2011, 4:59pm UTC](https://discuss.elastic.co/t/highlights-problems-with-a-filtered-query/4091/3 "2011-03-14T16:59:43Z")

</div>

Here is the gitst URL. Thanks.

git://gist.github.com/869446.git

On 14 mar, 16:11, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Can you gist a full recreation? ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help)).
> 
> On Monday, March 14, 2011 at 1:30 PM, alheim wrote:
> 
> > Hi folks,
> 
> > I have this query which does not highlight anything :
> 
> > {"query":  
> > {"filtered":  
> > {"query": {"query\_string":  
> > {"default\_field":"title","default\_operator":"AND","query":"_che_"}},  
> > "filter": {"or":[{"term":{"locations":1}},{"term":  
> > {"locations":2}}]},  
> > "highlight":{"fields":{"title":{"fragment\_size":  
> > 150,"number\_of\_fragments":3}}}  
> > }  
> > }  
> > }
> 
> > The result of the query is OK but nothing is highlighted.
> 
> > Thanks.

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [March 14, 2011, 10:09pm UTC](https://discuss.elastic.co/t/highlights-problems-with-a-filtered-query/4091/4 "2011-03-14T22:09:26Z")

</div>

Hi,

Check here for correct query JSON [869979’s gists · GitHub](https://gist.github.com/869979)  
[https://gist.github.com/869979](https://gist.github.com/869979)Note I moved the highlight element.

Regards,  
Lukas

On Mon, Mar 14, 2011 at 5:59 PM, alheim [alexheimburger@gmail.com](mailto:alexheimburger@gmail.com) wrote:

> Here is the gitst URL. Thanks.
> 
> git://gist.github.com/869446.git
> 
> On 14 mar, 16:11, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> 
> > Can you gist a full recreation? ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help)).
> > 
> > On Monday, March 14, 2011 at 1:30 PM, alheim wrote:
> > 
> > > Hi folks,
> > 
> > > I have this query which does not highlight anything :
> > 
> > > {"query":  
> > > {"filtered":  
> > > {"query": {"query\_string":  
> > > {"default\_field":"title","default\_operator":"AND","query":"_che_"}},  
> > > "filter": {"or":[{"term":{"locations":1}},{"term":  
> > > {"locations":2}}]},  
> > > "highlight":{"fields":{"title":{"fragment\_size":  
> > > 150,"number\_of\_fragments":3}}}  
> > > }  
> > > }  
> > > }
> > 
> > > The result of the query is OK but nothing is highlighted.
> > 
> > > Thanks.

---

<div class="post-metadata">

**Author:** ![Alexandre\_Heimburger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexandre_heimburger/32/2941_2.png) [@Alexandre\_Heimburger](https://discuss.elastic.co/u/Alexandre_Heimburger)\
**Post date:** [March 15, 2011, 7:37am UTC](https://discuss.elastic.co/t/highlights-problems-with-a-filtered-query/4091/5 "2011-03-15T07:37:03Z")

</div>

Perfect, thx a lot !

On Mon, Mar 14, 2011 at 11:09 PM, Lukáš Vlček [lukas.vlcek@gmail.com](mailto:lukas.vlcek@gmail.com) wrote:

> Hi,
> 
> Check here for correct query JSON [869979’s gists · GitHub](https://gist.github.com/869979)  
> [https://gist.github.com/869979](https://gist.github.com/869979)Note I moved the highlight element.
> 
> Regards,  
> Lukas
> 
> On Mon, Mar 14, 2011 at 5:59 PM, alheim [alexheimburger@gmail.com](mailto:alexheimburger@gmail.com) wrote:
> 
> > Here is the gitst URL. Thanks.
> > 
> > git://gist.github.com/869446.git
> > 
> > On 14 mar, 16:11, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:
> > 
> > > Can you gist a full recreation? ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help)).
> > > 
> > > On Monday, March 14, 2011 at 1:30 PM, alheim wrote:
> > > 
> > > > Hi folks,
> > > 
> > > > I have this query which does not highlight anything :
> > > 
> > > > {"query":  
> > > > {"filtered":  
> > > > {"query": {"query\_string":  
> > > > {"default\_field":"title","default\_operator":"AND","query":"_che_"}},  
> > > > "filter": {"or":[{"term":{"locations":1}},{"term":  
> > > > {"locations":2}}]},  
> > > > "highlight":{"fields":{"title":{"fragment\_size":  
> > > > 150,"number\_of\_fragments":3}}}  
> > > > }  
> > > > }  
> > > > }
> > > 
> > > > The result of the query is OK but nothing is highlighted.
> > > 
> > > > Thanks.

--  
Alexandre Heimburger  
R&D Manager  
blueKiwi Software  
tel : +33687880997  
email : [ahb@bluekiwi-software.com](mailto:ahb@bluekiwi-software.com)  
adress : 93 rue Vieille du Temple, 75003 Paris

What is blueKiwi? blueKiwi - the first Enterprise Social Software Suite in  
the world building professional networks on conversations and relationships

- helps large organizations increase their productivity, foster innovations  
and boost people satisfaction.

---

<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, 4:10am UTC](https://discuss.elastic.co/t/highlights-problems-with-a-filtered-query/4091/6 "2017-07-06T04:10:05Z")

</div>


