# Search Issue

**URL:** <https://discuss.elastic.co/t/search-issue/6992>\
**Category:** Elasticsearch\
**Created:** [March 14, 2012, 10:37am UTC](https://discuss.elastic.co/t/search-issue/6992 "2012-03-14T10:37:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ElasticUsers](https://avatars.discourse-cdn.com/v4/letter/e/51bf81/32.png) [@ElasticUsers](https://discuss.elastic.co/u/ElasticUsers)\
**Post date:** [March 14, 2012, 10:37am UTC](https://discuss.elastic.co/t/search-issue/6992/1 "2012-03-14T10:37:24Z")

</div>

Hi Team,

I have used the following mapping properties for a field called field1 :

"field1" : {  
"type" : "string",  
"omit\_norms" : true,  
"omit\_term\_freq\_and\_positions" : true  
}

Then injected some docs which contains values like "app value1" and "app-value1" for the app field.

Now when I enter query strings like following I am not getting back any data -

1. "query" : {  
"query\_string" : {  
"query" : "+field1:"app value1"",  
"default\_operator" : "and",  
"analyzer" : "search\_analyzer",  
"allow\_leading\_wildcard" : false,  
"analyze\_wildcard" : true  
}  
}

2. "query" : {  
"query\_string" : {  
"query" : "+field1:"app-value1"",  
"default\_operator" : "and",  
"analyzer" : "search\_analyzer",  
"allow\_leading\_wildcard" : false,  
"analyze\_wildcard" : true  
}  
}

When I enter query string like below I get back the data-

"query" : {  
"query\_string" : {  
"query" : "+field1:"app"",  
"default\_operator" : "and",  
"analyzer" : "search\_analyzer",  
"allow\_leading\_wildcard" : false,  
"analyze\_wildcard" : true  
}  
}

It means when I am looking for entire field value like "app value1" or app-value1 no data is retrieved, but when I search for fractions like app or value1 data is returned.

Please provide inputs on it. How will I be able to get the results when I search for whole value and not for fractions only.

Thanks..

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [March 14, 2012, 10:48am UTC](https://discuss.elastic.co/t/search-issue/6992/2 "2012-03-14T10:48:34Z")

</div>

Hiya

> 1. "query" : {  
> "query\_string" : {  
> "query" : "+field1:"app value1"",  
> "default\_operator" : "and",  
> "analyzer" : "search\_analyzer",  
> "allow\_leading\_wildcard" : false,  
> "analyze\_wildcard" : true  
> }  
> }

You are doing a phrase search ie docs with 'app' followed directly by  
'value1'. But you've specified "omit\_term\_freq\_and\_positions". So it  
doesn't know about the order of your terms.

> Please provide inputs on it. How will I be able to get the results when I  
> search for whole value and not for fractions only.

It sounds like you want this field to do exact matching, rather than  
full text queries.

So set it to {index: "not\_analyzed"} and search for it with a "term"  
query or filter.

This may or may not be the right answer, depending on what this data is  
and how you want to query it.

clint

---

<div class="post-metadata">

**Author:** ![ElasticUsers](https://avatars.discourse-cdn.com/v4/letter/e/51bf81/32.png) [@ElasticUsers](https://discuss.elastic.co/u/ElasticUsers)\
**Post date:** [March 14, 2012, 11:27am UTC](https://discuss.elastic.co/t/search-issue/6992/3 "2012-03-14T11:27:14Z")

</div>

Hi Clinton,

Now I have changed the mapping property like below :

"field1" : {"type" : "string","omit\_norms" : true, "omit\_term\_freq\_and\_positions" : true,"search\_analyzer" : "keyword","index\_analyzer" : "keyword"}

I am getting the results back for whole values but fractional searches are failing now.

I have also tried index: "not\_analyzed" in mapping and whole value searches worked but not fractional.

Does it make sense to use "search\_analyzer" : "keyword" and "index\_analyzer" : "keyword" in combination with "omit\_norms" : true and "omit\_term\_freq\_and\_positions" : true.

Thanks..

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [March 14, 2012, 11:34am UTC](https://discuss.elastic.co/t/search-issue/6992/4 "2012-03-14T11:34:05Z")

</div>

Hiya

> Now I have changed the mapping property like below :
> 
> "field1" : {"type" : "string","omit\_norms" : true,  
> "omit\_term\_freq\_and\_positions" : true,"search\_analyzer" :  
> "keyword","index\_analyzer" : "keyword"}
> 
> I am getting the results back for whole values but fractional searches are  
> failing now.

OK - that's what i meant by "this may or may not be the right answer".  
So you want to do full text searches, but allow for phrase searches.

In which case, keep the mapping as it was, but remove the  
"omit\_term\_freq\_and\_positions"

That will allow your phrase (ie positional) searches to work.

clint

---

<div class="post-metadata">

**Author:** ![ElasticUsers](https://avatars.discourse-cdn.com/v4/letter/e/51bf81/32.png) [@ElasticUsers](https://discuss.elastic.co/u/ElasticUsers)\
**Post date:** [March 15, 2012, 5:21am UTC](https://discuss.elastic.co/t/search-issue/6992/5 "2012-03-15T05:21:27Z")

</div>

Any input / suggestions on this !

---

<div class="post-metadata">

**Author:** ![ElasticUsers](https://avatars.discourse-cdn.com/v4/letter/e/51bf81/32.png) [@ElasticUsers](https://discuss.elastic.co/u/ElasticUsers)\
**Post date:** [March 21, 2012, 11:23am UTC](https://discuss.elastic.co/t/search-issue/6992/6 "2012-03-21T11:23:25Z")

</div>

Hi Clinton,

Thanks for the reply. If you could give us insight into what impact we will have on performance and memory optimization if we set omit\_term\_freq\_and\_positions to false or remove it completely..

Thanks..

---

<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, 3:35am UTC](https://discuss.elastic.co/t/search-issue/6992/7 "2017-07-06T03:35:17Z")

</div>


