# Indexing and searching on special characters

**URL:** <https://discuss.elastic.co/t/indexing-and-searching-on-special-characters/20919>\
**Category:** Elasticsearch\
**Created:** [November 24, 2014, 5:48pm UTC](https://discuss.elastic.co/t/indexing-and-searching-on-special-characters/20919 "2014-11-24T17:48:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anand\_kumar](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@Anand\_kumar](https://discuss.elastic.co/u/Anand_kumar)\
**Post date:** [November 24, 2014, 5:48pm UTC](https://discuss.elastic.co/t/indexing-and-searching-on-special-characters/20919/1 "2014-11-24T17:48:57Z")

</div>

Hi all,

I've been using elasticsearch-1.2.1 and I've been indexing .xml and .jsp  
file content.

And this is how my index has been analyzed as:

```
    "settings": {
         "analysis": {
             "filter": {
                "word_delimiter" : {
                   "type" : "word_delimiter",
                   "preserve_original" : true,
                   "split_on_case_change" : false,
                   "stem_english_possessive" : false,
                   "type_table" : [
                                          "# => ALPHA", 
                                          "@ => ALPHA",
                                          "$ => ALPHA", 
                                          "& => ALPHA",
                                          "? => ALPHA",
                                          "= => ALPHA"
                                         ]
                }
             },
             "analyzer": {
                "custom_analyzer" : {
                   "type" : "custom",
                   "tokenizer" : "whitespace",
                   "filter" : ["word_delimiter", "lowercase"]
                }
          }
    }

```

And the file contains one of the lines as, _\<%@ page  
import="java.util.Vector" %\>_.

While searching the index as _import="java.\*\*, i'm getting the result as  
expected. But while searching for the keyword_ "import"\*, I dint get any of  
the result.

On analyzing with the help of kopf plugin, I came to know my content \*import="java.util.Vector"  
\*was indexed into \*import="java.util.Vector", \*\*import=, \*_java, util and  
vector._

But what I want is \*import= _to be indexed as it is and as well as_ import,  
\*so that it'll match my scenario.

Also I've tried other option i.e. without the type\_table, in that case my  
search results gets reversed. The keyword search for _"import"_ works and _import="java._"  
\*doesn't seems to be working.

Anybody have any idea on how the index should be analyzed to get my desired  
index?

--  
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/27051ee9-7b25-461c-96ee-36cc1747ed11%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/27051ee9-7b25-461c-96ee-36cc1747ed11%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Anand\_kumar](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@Anand\_kumar](https://discuss.elastic.co/u/Anand_kumar)\
**Post date:** [December 3, 2014, 6:28am UTC](https://discuss.elastic.co/t/indexing-and-searching-on-special-characters/20919/2 "2014-12-03T06:28:06Z")

</div>

In the type\_table mentioned above, assinging "= =\> DIGIT" instead of "=  
=\>ALPHA" yields the indexing as I expected.

On Monday, 24 November 2014 23:18:58 UTC+5:30, Anand kumar wrote:

> Hi all,
> 
> I've been using elasticsearch-1.2.1 and I've been indexing .xml and .jsp  
> file content.
> 
> And this is how my index has been analyzed as:
> 
> ```
> "settings": {
> "analysis": {
> "filter": {
> "word_delimiter" : {
> "type" : "word_delimiter",
> "preserve_original" : true,
> "split_on_case_change" : false,
> "stem_english_possessive" : false,
> "type_table" : [
> "# => ALPHA", 
> "@ => ALPHA",
> "$ => ALPHA", 
> "& => ALPHA",
> "? => ALPHA",
> "= => ALPHA"
> ]
> }
> },
> "analyzer": {
> "custom_analyzer" : {
> "type" : "custom",
> "tokenizer" : "whitespace",
> "filter" : ["word_delimiter", "lowercase"]
> }
> }
> }
> 
> ```
> 
> And the file contains one of the lines as, _\<%@ page  
> import="java.util.Vector" %\>_.
> 
> While searching the index as _import="java.\*\*, i'm getting the result as  
> expected. But while searching for the keyword_ "import"\*, I dint get any  
> of the result.
> 
> On analyzing with the help of kopf plugin, I came to know my content \*import="java.util.Vector"  
> \*was indexed into \*import="java.util.Vector", \*\*import=, \*_java, util and  
> vector._
> 
> But what I want is \*import= _to be indexed as it is and as well as_ import,  
> \*so that it'll match my scenario.
> 
> Also I've tried other option i.e. without the type\_table, in that case my  
> search results gets reversed. The keyword search for _"import"_ works and _import="java._"  
> \*doesn't seems to be working.
> 
> Anybody have any idea on how the index should be analyzed to get my  
> desired index?

--  
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/a0073b0d-aa4b-4160-b6a7-35fe718e2107%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a0073b0d-aa4b-4160-b6a7-35fe718e2107%40googlegroups.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:46am UTC](https://discuss.elastic.co/t/indexing-and-searching-on-special-characters/20919/3 "2017-07-06T00:46:26Z")

</div>


