# Index JSON and stopwords with apostrophe

**URL:** <https://discuss.elastic.co/t/index-json-and-stopwords-with-apostrophe/10673>\
**Category:** Elasticsearch\
**Created:** [February 8, 2013, 8:25pm UTC](https://discuss.elastic.co/t/index-json-and-stopwords-with-apostrophe/10673 "2013-02-08T20:25:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Felipe\_Hummel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felipe_hummel/32/1263_2.png) [@Felipe\_Hummel](https://discuss.elastic.co/u/Felipe_Hummel)\
**Post date:** [February 8, 2013, 8:25pm UTC](https://discuss.elastic.co/t/index-json-and-stopwords-with-apostrophe/10673/1 "2013-02-08T20:25:53Z")

</div>

Hey guys, I'm trying to set a custom list of stopwords in the JSON that  
creates an index.

Like this: "stopwords" : ["i'm", "you're" ....] . But when I check the  
index metadata (through HEAD plugin), it seems it is parsing it wrong. It  
states: index.analysis.filter.myStopFilter..stopwords.179: im, youre

I tried escaping, but ' should not be escaped inside JSON (it gives syntax  
error)

I've tried searching for "i'm" and it finds results so it is not using it  
right.

Any ideas?

Felipe Hummel

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![hazzadous](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hazzadous/32/1654_2.png) [@hazzadous](https://discuss.elastic.co/u/hazzadous)\
**Post date:** [February 8, 2013, 11:48pm UTC](https://discuss.elastic.co/t/index-json-and-stopwords-with-apostrophe/10673/2 "2013-02-08T23:48:51Z")

</div>

This works for me:

$ curl -XPOST localhost:9200/test -d '  
{  
"settings": {  
"analysis": {  
"analyzer": {  
"default": {  
"type": "standard",  
"stopwords": ["i'"'"'m"]  
}  
}  
}  
}  
}'

$ curl localhost:9200/test/\_analyze?text=i'm  
{"tokens":}

Maybe there is some escaping issue when you're putting the mappings? What  
do your index settings/mappings look like?

On Friday, February 8, 2013 8:25:53 PM UTC, Felipe Hummel wrote:

> Hey guys, I'm trying to set a custom list of stopwords in the JSON that  
> creates an index.
> 
> Like this: "stopwords" : ["i'm", "you're" ....] . But when I check the  
> index metadata (through HEAD plugin), it seems it is parsing it wrong. It  
> states: index.analysis.filter.myStopFilter..stopwords.179: im, youre
> 
> I tried escaping, but ' should not be escaped inside JSON (it gives syntax  
> error)
> 
> I've tried searching for "i'm" and it finds results so it is not using it  
> right.
> 
> Any ideas?
> 
> Felipe Hummel

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Harry\_Waye](https://avatars.discourse-cdn.com/v4/letter/h/f04885/32.png) [@Harry\_Waye](https://discuss.elastic.co/u/Harry_Waye)\
**Post date:** [February 8, 2013, 11:59pm UTC](https://discuss.elastic.co/t/index-json-and-stopwords-with-apostrophe/10673/3 "2013-02-08T23:59:48Z")

</div>

On second glance that's obviously the case! Might help to give your full  
index creation post body and the responses you get for settings and  
mappings.

On Friday, 8 February 2013 23:48:51 UTC, hazzadous wrote:

> This works for me:
> 
> $ curl -XPOST localhost:9200/test -d '  
> {  
> "settings": {  
> "analysis": {  
> "analyzer": {  
> "default": {  
> "type": "standard",  
> "stopwords": ["i'"'"'m"]  
> }  
> }  
> }  
> }  
> }'
> 
> $ curl localhost:9200/test/\_analyze?text=i'm  
> {"tokens":}
> 
> Maybe there is some escaping issue when you're putting the mappings? What  
> do your index settings/mappings look like?
> 
> On Friday, February 8, 2013 8:25:53 PM UTC, Felipe Hummel wrote:
> 
> > Hey guys, I'm trying to set a custom list of stopwords in the JSON that  
> > creates an index.
> > 
> > Like this: "stopwords" : ["i'm", "you're" ....] . But when I check the  
> > index metadata (through HEAD plugin), it seems it is parsing it wrong. It  
> > states: index.analysis.filter.myStopFilter..stopwords.179: im, youre
> > 
> > I tried escaping, but ' should not be escaped inside JSON (it gives  
> > syntax error)
> > 
> > I've tried searching for "i'm" and it finds results so it is not using it  
> > right.
> > 
> > Any ideas?
> > 
> > Felipe Hummel

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Felipe\_Hummel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/felipe_hummel/32/1263_2.png) [@Felipe\_Hummel](https://discuss.elastic.co/u/Felipe_Hummel)\
**Post date:** [February 9, 2013, 5:43pm UTC](https://discuss.elastic.co/t/index-json-and-stopwords-with-apostrophe/10673/4 "2013-02-09T17:43:17Z")

</div>

The settings were giving me this:  
"index.analysis.filter.myStopFilter..stopwords.179": "im, youre"

With your way it gives me the correct form:

"index.analysis.filter.buskTokenFilter.stopwords.0":"i'm",

"index.analysis.filter.buskTokenFilter.stopwords.1":"you're",

Why that works? What is you'"'"'re ?

Thanks!

Felipe Hummel

On Friday, February 8, 2013 4:25:53 PM UTC-4, Felipe Hummel wrote:

> Hey guys, I'm trying to set a custom list of stopwords in the JSON that  
> creates an index.
> 
> Like this: "stopwords" : ["i'm", "you're" ....] . But when I check the  
> index metadata (through HEAD plugin), it seems it is parsing it wrong. It  
> states: index.analysis.filter.myStopFilter..stopwords.179: im, youre
> 
> I tried escaping, but ' should not be escaped inside JSON (it gives syntax  
> error)
> 
> I've tried searching for "i'm" and it finds results so it is not using it  
> right.
> 
> Any ideas?
> 
> Felipe Hummel

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Harry\_Waye](https://avatars.discourse-cdn.com/v4/letter/h/f04885/32.png) [@Harry\_Waye](https://discuss.elastic.co/u/Harry_Waye)\
**Post date:** [February 10, 2013, 12:41am UTC](https://discuss.elastic.co/t/index-json-and-stopwords-with-apostrophe/10673/5 "2013-02-10T00:41:58Z")

</div>

I got the syntax  
from [bash - How to escape single quotes within single quoted strings - Stack Overflow](http://stackoverflow.com/questions/1250079/bash-escaping-single-quotes-inside-of-single-quoted-strings)

I hadn't seen it before but good to know! Far from obvious.

On Saturday, 9 February 2013 17:43:17 UTC, Felipe Hummel wrote:

> The settings were giving me this:  
> "index.analysis.filter.myStopFilter..stopwords.179": "im, youre"
> 
> With your way it gives me the correct form:
> 
> "index.analysis.filter.buskTokenFilter.stopwords.0":"i'm",
> 
> "index.analysis.filter.buskTokenFilter.stopwords.1":"you're",
> 
> Why that works? What is you'"'"'re ?
> 
> Thanks!
> 
> Felipe Hummel
> 
> On Friday, February 8, 2013 4:25:53 PM UTC-4, Felipe Hummel wrote:
> 
> > Hey guys, I'm trying to set a custom list of stopwords in the JSON that  
> > creates an index.
> > 
> > Like this: "stopwords" : ["i'm", "you're" ....] . But when I check the  
> > index metadata (through HEAD plugin), it seems it is parsing it wrong. It  
> > states: index.analysis.filter.myStopFilter..stopwords.179: im, youre
> > 
> > I tried escaping, but ' should not be escaped inside JSON (it gives  
> > syntax error)
> > 
> > I've tried searching for "i'm" and it finds results so it is not using it  
> > right.
> > 
> > Any ideas?
> > 
> > Felipe Hummel

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [February 10, 2013, 2:33pm UTC](https://discuss.elastic.co/t/index-json-and-stopwords-with-apostrophe/10673/6 "2013-02-10T14:33:21Z")

</div>

On Sat, 2013-02-09 at 16:41 -0800, Harry Waye wrote:

> I got the syntax  
> from [bash - How to escape single quotes within single quoted strings - Stack Overflow](http://stackoverflow.com/questions/1250079/bash-escaping-single-quotes-inside-of-single-quoted-strings)
> 
> I hadn't seen it before but good to know! Far from obvious.

You can also escape single quotes in JSON as \u0027

clint

> On Saturday, 9 February 2013 17:43:17 UTC, Felipe Hummel wrote:  
> The settings were giving me this:  
> "index.analysis.filter.myStopFilter..stopwords.179": "im,  
> youre"
> 
> ```
> With your way it gives me the correct form:
>     
>     
> "index.analysis.filter.buskTokenFilter.stopwords.0":"i'm",
>     
> "index.analysis.filter.buskTokenFilter.stopwords.1":"you're",
>     
>     
> Why that works? What is you'"'"'re ?
>     
>     
> Thanks!
>     
>     
> Felipe Hummel
>     
>     
> On Friday, February 8, 2013 4:25:53 PM UTC-4, Felipe Hummel
> wrote:
> Hey guys, I'm trying to set a custom list of stopwords
> in the JSON that creates an index.
>             
> Like this: "stopwords" : ["i'm", "you're" ....] . But
> when I check the index metadata (through HEAD plugin),
> it seems it is parsing it wrong. It states:
> index.analysis.filter.myStopFilter..stopwords.179: im,
> youre
>             
> I tried escaping, but ' should not be escaped inside
> JSON (it gives syntax error) 
>             
>             
> I've tried searching for "i'm" and it finds results so
> it is not using it right.
>             
> Any ideas?
>             
> Felipe Hummel
> 
> ```
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Harry\_Waye](https://avatars.discourse-cdn.com/v4/letter/h/f04885/32.png) [@Harry\_Waye](https://discuss.elastic.co/u/Harry_Waye)\
**Post date:** [February 11, 2013, 10:50am UTC](https://discuss.elastic.co/t/index-json-and-stopwords-with-apostrophe/10673/7 "2013-02-11T10:50:24Z")

</div>

Ah, much less obscure/shell specific.

On Sunday, 10 February 2013 14:33:21 UTC, Clinton Gormley wrote:

> On Sat, 2013-02-09 at 16:41 -0800, Harry Waye wrote:
> 
> > I got the syntax  
> > from  
> > [bash - How to escape single quotes within single quoted strings - Stack Overflow](http://stackoverflow.com/questions/1250079/bash-escaping-single-quotes-inside-of-single-quoted-strings)
> > 
> > I hadn't seen it before but good to know! Far from obvious.
> 
> You can also escape single quotes in JSON as \u0027
> 
> clint
> 
> > On Saturday, 9 February 2013 17:43:17 UTC, Felipe Hummel wrote:  
> > The settings were giving me this:  
> > "index.analysis.filter.myStopFilter..stopwords.179": "im,  
> > youre"
> > 
> > ```
> > With your way it gives me the correct form: 
> >     
> >     
> > "index.analysis.filter.buskTokenFilter.stopwords.0":"i'm", 
> >     
> > "index.analysis.filter.buskTokenFilter.stopwords.1":"you're", 
> >     
> >     
> > Why that works? What is you'"'"'re ? 
> >     
> >     
> > Thanks! 
> >     
> >     
> > Felipe Hummel 
> >     
> >     
> > On Friday, February 8, 2013 4:25:53 PM UTC-4, Felipe Hummel 
> > wrote: 
> > Hey guys, I'm trying to set a custom list of stopwords 
> > in the JSON that creates an index. 
> >             
> > Like this: "stopwords" : ["i'm", "you're" ....] . But 
> > when I check the index metadata (through HEAD plugin), 
> > it seems it is parsing it wrong. It states: 
> > index.analysis.filter.myStopFilter..stopwords.179: im, 
> > youre 
> >             
> > I tried escaping, but ' should not be escaped inside 
> > JSON (it gives syntax error) 
> >             
> >             
> > I've tried searching for "i'm" and it finds results so 
> > it is not using it right. 
> >             
> > Any ideas? 
> >             
> > Felipe Hummel 
> > 
> > ```
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:52am UTC](https://discuss.elastic.co/t/index-json-and-stopwords-with-apostrophe/10673/8 "2017-07-06T02:52:09Z")

</div>


