# Searching with punctuation

**URL:** <https://discuss.elastic.co/t/searching-with-punctuation/69686>\
**Category:** Elasticsearch\
**Created:** [December 21, 2016, 4:14pm UTC](https://discuss.elastic.co/t/searching-with-punctuation/69686 "2016-12-21T16:14:26Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![wrap](https://avatars.discourse-cdn.com/v4/letter/w/2acd7d/32.png) [@wrap](https://discuss.elastic.co/u/wrap)\
**Post date:** [December 21, 2016, 4:14pm UTC](https://discuss.elastic.co/t/searching-with-punctuation/69686/1 "2016-12-21T16:14:26Z")

</div>

Hi,

Our search is working great until it come's to punctuation. If you don't use the punctuation that we have in our data, you will get zero results. For example, in our data we have "Corinna's Cause", so if you were to search that exactly (with the apostrophe) you will get good relevant results. However, if you search without the apostrophe "Corinnas Cause" you will receive zero results. What do we need to do to get around this?

Thank you for any help.

---

<div class="post-metadata">

**Author:** ![xavierfacq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xavierfacq/32/8744_2.png) [@xavierfacq](https://discuss.elastic.co/u/xavierfacq)\
**Post date:** [December 21, 2016, 4:18pm UTC](https://discuss.elastic.co/t/searching-with-punctuation/69686/2 "2016-12-21T16:18:31Z")

</div>

Hi,

Can you give us the mapping of your fields and a query sample ?

bye,  
Xavier

---

<div class="post-metadata">

**Author:** ![wrap](https://avatars.discourse-cdn.com/v4/letter/w/2acd7d/32.png) [@wrap](https://discuss.elastic.co/u/wrap)\
**Post date:** [December 22, 2016, 10:54am UTC](https://discuss.elastic.co/t/searching-with-punctuation/69686/3 "2016-12-22T10:54:23Z")

</div>

Hi Xavierfacq,

Here is a query sample for the Corinna's Cause search: localhost:9200/ab/\_search?q=Title:corrina's cause\*&size=500

The title field (book title) is mapped to our alias field that is used to find search keywords. After searching for the keyword in the title field we search in these fields respectively - Author, EAN, ISBN and publisher.

Thank you.

---

<div class="post-metadata">

**Author:** ![xavierfacq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xavierfacq/32/8744_2.png) [@xavierfacq](https://discuss.elastic.co/u/xavierfacq)\
**Post date:** [December 22, 2016, 1:29pm UTC](https://discuss.elastic.co/t/searching-with-punctuation/69686/4 "2016-12-22T13:29:07Z")

</div>

Hi can you provide result of :

```
localhost:9200/ab/_mapping?pretty=
```

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [December 22, 2016, 2:09pm UTC](https://discuss.elastic.co/t/searching-with-punctuation/69686/5 "2016-12-22T14:09:21Z")

</div>

Maybe a typo? You search for `corrina's cause` but the indexed title is `corinna's cause`

To handle these situations, you should add spellcheck suggestions [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html)

---

<div class="post-metadata">

**Author:** ![wrap](https://avatars.discourse-cdn.com/v4/letter/w/2acd7d/32.png) [@wrap](https://discuss.elastic.co/u/wrap)\
**Post date:** [December 22, 2016, 2:26pm UTC](https://discuss.elastic.co/t/searching-with-punctuation/69686/6 "2016-12-22T14:26:31Z")

</div>

Hi Xavier,

Sure, here's the results:

{  
"ab" : {  
"mappings" : {  
"items" : {  
"properties" : {  
"AliasTitle" : {  
"type" : "string"  
},  
"Author" : {  
"type" : "string"  
},  
"AuthorLinks" : {  
"type" : "string"  
},  
"DiscoveryID" : {  
"type" : "string"  
},  
"DiscoveryName" : {  
"type" : "string"  
},  
"EAN" : {  
"type" : "string"  
},  
"ISBN" : {  
"type" : "string"  
},  
"ImageUrl" : {  
"type" : "string"  
},  
"ProductID" : {  
"type" : "string"  
},  
"ProductType" : {  
"type" : "integer"  
},  
"Publisher" : {  
"type" : "string"  
},  
"SalesCount" : {  
"type" : "integer"  
},  
"StockCount" : {  
"type" : "integer"  
},  
"Title" : {  
"type" : "string"  
}  
}  
},  
"item" : {  
"properties" : {  
"AliasTitle" : {  
"type" : "string"  
},  
"Author" : {  
"type" : "string"  
},  
"AuthorLinks" : {  
"type" : "string"  
},  
"DiscoveryID" : {  
"type" : "string"  
},  
"DiscoveryName" : {  
"type" : "string"  
},  
"EAN" : {  
"type" : "string"  
},  
"ISBN" : {  
"type" : "string"  
},  
"ImageURL" : {  
"type" : "string"  
},  
"ProductID" : {  
"type" : "string"  
},  
"ProductType" : {  
"type" : "integer"  
},  
"Publisher" : {  
"type" : "string"  
},  
"SalesCount" : {  
"type" : "integer"  
},  
"StockCount" : {  
"type" : "integer"  
},  
"Title" : {  
"type" : "string"  
}  
}  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![wrap](https://avatars.discourse-cdn.com/v4/letter/w/2acd7d/32.png) [@wrap](https://discuss.elastic.co/u/wrap)\
**Post date:** [December 22, 2016, 2:29pm UTC](https://discuss.elastic.co/t/searching-with-punctuation/69686/7 "2016-12-22T14:29:41Z")

</div>

Hi jprante, yea the suggester could do the job if it works with punctuation. Shll check it out.

---

<div class="post-metadata">

**Author:** ![xavierfacq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xavierfacq/32/8744_2.png) [@xavierfacq](https://discuss.elastic.co/u/xavierfacq)\
**Post date:** [December 22, 2016, 3:24pm UTC](https://discuss.elastic.co/t/searching-with-punctuation/69686/8 "2016-12-22T15:24:21Z")

</div>

> [@wrap](#):
>
> if you search without the apostrophe "Corinnas Cause" you will receive zero results

"Corinna's Cause" cannot be equal to "Corinnas Cause", unless you have a special analyzer.

Does it work with a term : "Corinna Cause" , without the "s" and the quote ?

```
localhost:9200/ab/_search?q=Title:corrina+cause&size=500

```

---

<div class="post-metadata">

**Author:** ![wrap](https://avatars.discourse-cdn.com/v4/letter/w/2acd7d/32.png) [@wrap](https://discuss.elastic.co/u/wrap)\
**Post date:** [January 4, 2017, 11:31am UTC](https://discuss.elastic.co/t/searching-with-punctuation/69686/9 "2017-01-04T11:31:36Z")

</div>

Sorry for late response, Christmas got in the way!

No it doesn't work if I search "Corinna Cause". It has to be exactly the same as our data, so it will only work when I search with the correct punctuation. If I were to search "Cause Joanna" however it would work. It will identify "cause" in our title field and "Joanna" in our author field and show the result. If I search "corinna joanna" you get nothing. The punctuation is causing the problem with the search results. Ideally we need "Corinna's Cause" to be equal to "Corinnas Cause" but you say this can't be done without a special analyzer? What do you mean by this please?

Thank you.

---

<div class="post-metadata">

**Author:** ![xavierfacq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xavierfacq/32/8744_2.png) [@xavierfacq](https://discuss.elastic.co/u/xavierfacq)\
**Post date:** [January 6, 2017, 11:19am UTC](https://discuss.elastic.co/t/searching-with-punctuation/69686/10 "2017-01-06T11:19:01Z")

</div>

What I understand is that your query is applied to the field "Title" of documents "items" and "item" in your index "ab". Those fields seems to be only a String, and no specific analyer seems to be applied.

So, questions are:

1°/ Does a search with the word "cause" works ?

2°/ Does a search with the word "Joanna" works ?

3°/ Does a search with the word "corinna" works ?

4°/ Does a search with the word "corrina" works ?

---

<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:** [February 3, 2017, 11:19am UTC](https://discuss.elastic.co/t/searching-with-punctuation/69686/11 "2017-02-03T11:19:16Z")

</div>

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