# QueryString

**URL:** https://discuss.elastic.co/t/querystring/6978
**Category:** Elasticsearch
**Created:** [March 13, 2012, 2:46pm UTC](https://discuss.elastic.co/t/querystring/6978 "2012-03-13T14:46:42Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![k4Rla](https://avatars.discourse-cdn.com/v4/letter/k/41988e/32.png) [@k4Rla](https://discuss.elastic.co/u/k4Rla)
#### Post date: [March 13, 2012, 2:46pm UTC](https://discuss.elastic.co/t/querystring/6978/1 "2012-03-13T14:46:42Z")

</div>

Hi, here is problem with QueryString search in cyrillic using Snowball.  
When i'm search some word using _, Elastic returns no results, where this  
word matches, it returns me only results with length, longer than query  
word length. For example. I have query word Auto (in russian Авто) and  
documents with \_source ['name'] =\> Auto, ['name'] =\> Automobile, ['name']  
=\> Automobile showroom. If i search 'Auto_' Elastic returns me only  
"Automobile" and "Automobile showroom", but not 'Auto'. When i'am using  
english versions of this words everything workes fine.

Here is some settings. (Elastica client used, looks simple, but if that  
need i can comment some rows).

public static $\_elastica = array(  
'number\_of\_shards' =\> 4,  
'number\_of\_replicas' =\> 1,  
'analysis' =\> array(  
'analyzer' =\> array(  
'indexAnalyzer' =\> array(  
'type' =\> 'custom',  
'tokenizer' =\> 'standard',  
'filter' =\> array('lowercase', 'mySnowball')  
),  
'searchAnalyzer' =\> array(  
'type' =\> 'custom',  
'tokenizer' =\> 'standard',  
'filter' =\> array('lowercase', 'mySnowball', 'stop')  
)  
),  
'filter' =\> array(  
'mySnowball' =\> array(  
'type' =\> 'snowball',  
'language' =\> 'russian',  
),  
'stop' =\> array(  
'type' =\> 'stop',  
'stopwords' =\>  
'а,без,более,бы,был,была,были,было,быть,в,вам,вас,весь,во,вот,все,всего,всех,вы,где,да,даже,для,до,его,ее,если,есть,еще,же,за,здесь,и,из,или,им,их,к,как,ко,когда,кто,ли,либо,мне,может,мы,на,надо,наш,не,него,нее,нет,ни,них,но,ну,о,об,однако,он,она,они,оно,от,очень,по,под,при,с,со,так,также,такой,там,те,тем,то,того,тоже,той,только,том,ты,у,уже,хотя,чего,чей,чем,что,чтобы,чье,чья,эта,эти,это,я',  
)  
)  
)  
);

//Here we set it to index  
$index-\>create(self::$\_elastica, true);

//And here is when we creating a document  
$mapping = new Elastica\_Type\_Mapping($type, self::$\_elastica);  
$mapping-\>setProperties(self::$\_elasticaMapping);  
$mapping-\>setParam('index\_analyzer', 'indexAnalyzer');  
$mapping-\>setParam('search\_analyzer', 'searchAnalyzer');  
$mapping-\>send();

//This is a search field mapping  
'name' =\> array('type' =\> 'string', '\_analyzer' =\> array('path' =\>  
'mySnowball'))

//And here is a search query  
$query = new Elastica\_Query\_QueryString('Авто\*');  
$query-\>setAnalyzer('searchAnalyzer');

---

<div class="post-metadata">

### Author: ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)
#### Post date: [March 13, 2012, 3:38pm UTC](https://discuss.elastic.co/t/querystring/6978/2 "2012-03-13T15:38:04Z")

</div>

The Russian Snowball analyzer translates word "Авто" into token "авт":

curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d "Авто"  
Авто{"tokens":[{"token":"авт","start\_offset":0,"end\_offset":4,"type":"","position":1}]}%

Lucene doesn't apply analyzer to wildcard queries, it only lowercases terms  
there. So, your query is translated into Lucene wildcard query looking for  
all terms that starts with "авто". "авт" doesn't start with "авто" and  
that's why the record is not returned.

On Tuesday, March 13, 2012 10:46:42 AM UTC-4, k4Rla wrote:

> Hi, here is problem with QueryString search in cyrillic using Snowball.  
> When i'm search some word using _, Elastic returns no results, where this  
> word matches, it returns me only results with length, longer than query  
> word length. For example. I have query word Auto (in russian Авто) and  
> documents with \_source ['name'] =\> Auto, ['name'] =\> Automobile, ['name']  
> =\> Automobile showroom. If i search 'Auto_' Elastic returns me only  
> "Automobile" and "Automobile showroom", but not 'Auto'. When i'am using  
> english versions of this words everything workes fine.
> 
> Here is some settings. (Elastica client used, looks simple, but if that  
> need i can comment some rows).
> 
> public static $\_elastica = array(  
> 'number\_of\_shards' =\> 4,  
> 'number\_of\_replicas' =\> 1,  
> 'analysis' =\> array(  
> 'analyzer' =\> array(  
> 'indexAnalyzer' =\> array(  
> 'type' =\> 'custom',  
> 'tokenizer' =\> 'standard',  
> 'filter' =\> array('lowercase', 'mySnowball')  
> ),  
> 'searchAnalyzer' =\> array(  
> 'type' =\> 'custom',  
> 'tokenizer' =\> 'standard',  
> 'filter' =\> array('lowercase', 'mySnowball', 'stop')  
> )  
> ),  
> 'filter' =\> array(  
> 'mySnowball' =\> array(  
> 'type' =\> 'snowball',  
> 'language' =\> 'russian',  
> ),  
> 'stop' =\> array(  
> 'type' =\> 'stop',  
> 'stopwords' =\>  
> 'а,без,более,бы,был,была,были,было,быть,в,вам,вас,весь,во,вот,все,всего,всех,вы,где,да,даже,для,до,его,ее,если,есть,еще,же,за,здесь,и,из,или,им,их,к,как,ко,когда,кто,ли,либо,мне,может,мы,на,надо,наш,не,него,нее,нет,ни,них,но,ну,о,об,однако,он,она,они,оно,от,очень,по,под,при,с,со,так,также,такой,там,те,тем,то,того,тоже,той,только,том,ты,у,уже,хотя,чего,чей,чем,что,чтобы,чье,чья,эта,эти,это,я',  
> )  
> )  
> )  
> );
> 
> //Here we set it to index  
> $index-\>create(self::$\_elastica, true);
> 
> //And here is when we creating a document  
> $mapping = new Elastica\_Type\_Mapping($type, self::$\_elastica);  
> $mapping-\>setProperties(self::$\_elasticaMapping);  
> $mapping-\>setParam('index\_analyzer', 'indexAnalyzer');  
> $mapping-\>setParam('search\_analyzer', 'searchAnalyzer');  
> $mapping-\>send();
> 
> //This is a search field mapping  
> 'name' =\> array('type' =\> 'string', '\_analyzer' =\> array('path' =\>  
> 'mySnowball'))
> 
> //And here is a search query  
> $query = new Elastica\_Query\_QueryString('Авто\*');  
> $query-\>setAnalyzer('searchAnalyzer');

---

<div class="post-metadata">

### Author: ![k4Rla](https://avatars.discourse-cdn.com/v4/letter/k/41988e/32.png) [@k4Rla](https://discuss.elastic.co/u/k4Rla)
#### Post date: [March 13, 2012, 4:06pm UTC](https://discuss.elastic.co/t/querystring/6978/3 "2012-03-13T16:06:27Z")

</div>

Thank you for answer, any chance to resolve it? I need to request "Авто",  
and get results, that match for "Авто\*". And another one question, when  
i'm searching for 'Автомобиль', it returns me "Автомобильный туризм", but  
not "Японские автомобили", is this same reason?

On Tuesday, March 13, 2012 6:46:42 PM UTC+4, k4Rla wrote:

> Hi, here is problem with QueryString search in cyrillic using Snowball.  
> When i'm search some word using _, Elastic returns no results, where this  
> word matches, it returns me only results with length, longer than query  
> word length. For example. I have query word Auto (in russian Авто) and  
> documents with \_source ['name'] =\> Auto, ['name'] =\> Automobile, ['name']  
> =\> Automobile showroom. If i search 'Auto_' Elastic returns me only  
> "Automobile" and "Automobile showroom", but not 'Auto'. When i'am using  
> english versions of this words everything workes fine.
> 
> Here is some settings. (Elastica client used, looks simple, but if that  
> need i can comment some rows).
> 
> public static $\_elastica = array(  
> 'number\_of\_shards' =\> 4,  
> 'number\_of\_replicas' =\> 1,  
> 'analysis' =\> array(  
> 'analyzer' =\> array(  
> 'indexAnalyzer' =\> array(  
> 'type' =\> 'custom',  
> 'tokenizer' =\> 'standard',  
> 'filter' =\> array('lowercase', 'mySnowball')  
> ),  
> 'searchAnalyzer' =\> array(  
> 'type' =\> 'custom',  
> 'tokenizer' =\> 'standard',  
> 'filter' =\> array('lowercase', 'mySnowball', 'stop')  
> )  
> ),  
> 'filter' =\> array(  
> 'mySnowball' =\> array(  
> 'type' =\> 'snowball',  
> 'language' =\> 'russian',  
> ),  
> 'stop' =\> array(  
> 'type' =\> 'stop',  
> 'stopwords' =\>  
> 'а,без,более,бы,был,была,были,было,быть,в,вам,вас,весь,во,вот,все,всего,всех,вы,где,да,даже,для,до,его,ее,если,есть,еще,же,за,здесь,и,из,или,им,их,к,как,ко,когда,кто,ли,либо,мне,может,мы,на,надо,наш,не,него,нее,нет,ни,них,но,ну,о,об,однако,он,она,они,оно,от,очень,по,под,при,с,со,так,также,такой,там,те,тем,то,того,тоже,той,только,том,ты,у,уже,хотя,чего,чей,чем,что,чтобы,чье,чья,эта,эти,это,я',  
> )  
> )  
> )  
> );
> 
> //Here we set it to index  
> $index-\>create(self::$\_elastica, true);
> 
> //And here is when we creating a document  
> $mapping = new Elastica\_Type\_Mapping($type, self::$\_elastica);  
> $mapping-\>setProperties(self::$\_elasticaMapping);  
> $mapping-\>setParam('index\_analyzer', 'indexAnalyzer');  
> $mapping-\>setParam('search\_analyzer', 'searchAnalyzer');  
> $mapping-\>send();
> 
> //This is a search field mapping  
> 'name' =\> array('type' =\> 'string', '\_analyzer' =\> array('path' =\>  
> 'mySnowball'))
> 
> //And here is a search query  
> $query = new Elastica\_Query\_QueryString('Авто\*');  
> $query-\>setAnalyzer('searchAnalyzer');

---

<div class="post-metadata">

### Author: ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)
#### Post date: [March 13, 2012, 4:21pm UTC](https://discuss.elastic.co/t/querystring/6978/4 "2012-03-13T16:21:20Z")

</div>

Yes, if you are using a recent version of elasticsearch, you can  
specify analyze\_wildcard:true in your query. (See  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html))  
I think it was added in 0.18.6.

The second problem is caused by the way Russian Snowball analyzer works. As  
you can see below "Автомобиль" is translated into "автомобил", while  
"Автомобильный туризм" into "автомобильн", "туризм" and "Японские  
автомобили" into "японск", "автомоб".

$ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
"Автомобиль"  
{"tokens":[{"token":"автомобил","start\_offset":0,"end\_offset":10,"type":"","position":1}]}

$ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
"Автомобильный туризм"  
{"tokens":[{"token":"автомобильн","start\_offset":0,"end\_offset":13,"type":"","position":1},{"token":"туризм","start\_offset":14,"end\_offset":20,"type":"","position":2}]}

$ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
"Японские автомобили"  
{"tokens":[{"token":"японск","start\_offset":0,"end\_offset":8,"type":"","position":1},{"token":"автомоб","start\_offset":9,"end\_offset":19,"type":"","position":2}]}%

On Tuesday, March 13, 2012 12:06:27 PM UTC-4, k4Rla wrote:

> Thank you for answer, any chance to resolve it? I need to request "Авто",  
> and get results, that match for "Авто\*". And another one question, when  
> i'm searching for 'Автомобиль', it returns me "Автомобильный туризм", but  
> not "Японские автомобили", is this same reason?
> 
> On Tuesday, March 13, 2012 6:46:42 PM UTC+4, k4Rla wrote:
> 
> > Hi, here is problem with QueryString search in cyrillic using Snowball.  
> > When i'm search some word using _, Elastic returns no results, where this  
> > word matches, it returns me only results with length, longer than query  
> > word length. For example. I have query word Auto (in russian Авто) and  
> > documents with \_source ['name'] =\> Auto, ['name'] =\> Automobile, ['name']  
> > =\> Automobile showroom. If i search 'Auto_' Elastic returns me only  
> > "Automobile" and "Automobile showroom", but not 'Auto'. When i'am using  
> > english versions of this words everything workes fine.
> > 
> > Here is some settings. (Elastica client used, looks simple, but if that  
> > need i can comment some rows).
> > 
> > public static $\_elastica = array(  
> > 'number\_of\_shards' =\> 4,  
> > 'number\_of\_replicas' =\> 1,  
> > 'analysis' =\> array(  
> > 'analyzer' =\> array(  
> > 'indexAnalyzer' =\> array(  
> > 'type' =\> 'custom',  
> > 'tokenizer' =\> 'standard',  
> > 'filter' =\> array('lowercase', 'mySnowball')  
> > ),  
> > 'searchAnalyzer' =\> array(  
> > 'type' =\> 'custom',  
> > 'tokenizer' =\> 'standard',  
> > 'filter' =\> array('lowercase', 'mySnowball', 'stop')  
> > )  
> > ),  
> > 'filter' =\> array(  
> > 'mySnowball' =\> array(  
> > 'type' =\> 'snowball',  
> > 'language' =\> 'russian',  
> > ),  
> > 'stop' =\> array(  
> > 'type' =\> 'stop',  
> > 'stopwords' =\>  
> > 'а,без,более,бы,был,была,были,было,быть,в,вам,вас,весь,во,вот,все,всего,всех,вы,где,да,даже,для,до,его,ее,если,есть,еще,же,за,здесь,и,из,или,им,их,к,как,ко,когда,кто,ли,либо,мне,может,мы,на,надо,наш,не,него,нее,нет,ни,них,но,ну,о,об,однако,он,она,они,оно,от,очень,по,под,при,с,со,так,также,такой,там,те,тем,то,того,тоже,той,только,том,ты,у,уже,хотя,чего,чей,чем,что,чтобы,чье,чья,эта,эти,это,я',  
> > )  
> > )  
> > )  
> > );
> > 
> > //Here we set it to index  
> > $index-\>create(self::$\_elastica, true);
> > 
> > //And here is when we creating a document  
> > $mapping = new Elastica\_Type\_Mapping($type, self::$\_elastica);  
> > $mapping-\>setProperties(self::$\_elasticaMapping);  
> > $mapping-\>setParam('index\_analyzer', 'indexAnalyzer');  
> > $mapping-\>setParam('search\_analyzer', 'searchAnalyzer');  
> > $mapping-\>send();
> > 
> > //This is a search field mapping  
> > 'name' =\> array('type' =\> 'string', '\_analyzer' =\> array('path' =\>  
> > 'mySnowball'))
> > 
> > //And here is a search query  
> > $query = new Elastica\_Query\_QueryString('Авто\*');  
> > $query-\>setAnalyzer('searchAnalyzer');

---

<div class="post-metadata">

### Author: ![k4Rla](https://avatars.discourse-cdn.com/v4/letter/k/41988e/32.png) [@k4Rla](https://discuss.elastic.co/u/k4Rla)
#### Post date: [March 13, 2012, 5:03pm UTC](https://discuss.elastic.co/t/querystring/6978/5 "2012-03-13T17:03:26Z")

</div>

oh, i didn't saw that analize\_wildcard is false, my bad, now it's works  
perfect, thank you very much, but how to be with 'Автомобиль'? Have russian  
snowball some morfology?

On Tuesday, March 13, 2012 8:21:20 PM UTC+4, Igor Motov wrote:

> Yes, if you are using a recent version of elasticsearch, you can  
> specify analyze\_wildcard:true in your query. (See  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html))  
> I think it was added in 0.18.6.
> 
> The second problem is caused by the way Russian Snowball analyzer works.  
> As you can see below "Автомобиль" is translated into "автомобил", while  
> "Автомобильный туризм" into "автомобильн", "туризм" and "Японские  
> автомобили" into "японск", "автомоб".
> 
> $ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
> "Автомобиль"
> 
> {"tokens":[{"token":"автомобил","start\_offset":0,"end\_offset":10,"type":"","position":1}]}
> 
> $ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
> "Автомобильный туризм"
> 
> {"tokens":[{"token":"автомобильн","start\_offset":0,"end\_offset":13,"type":"","position":1},{"token":"туризм","start\_offset":14,"end\_offset":20,"type":"","position":2}]}
> 
> $ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
> "Японские автомобили"  
> {"tokens":[{"token":"японск","start\_offset":0,"end\_offset":8,"type":"","position":1},{"token":"автомоб","start\_offset":9,"end\_offset":19,"type":"","position":2}]}%
> 
> On Tuesday, March 13, 2012 12:06:27 PM UTC-4, k4Rla wrote:
> 
> > Thank you for answer, any chance to resolve it? I need to request "Авто",  
> > and get results, that match for "Авто\*". And another one question, when  
> > i'm searching for 'Автомобиль', it returns me "Автомобильный туризм",  
> > but not "Японские автомобили", is this same reason?
> > 
> > On Tuesday, March 13, 2012 6:46:42 PM UTC+4, k4Rla wrote:
> > 
> > > Hi, here is problem with QueryString search in cyrillic using Snowball.  
> > > When i'm search some word using _, Elastic returns no results, where this  
> > > word matches, it returns me only results with length, longer than query  
> > > word length. For example. I have query word Auto (in russian Авто) and  
> > > documents with \_source ['name'] =\> Auto, ['name'] =\> Automobile, ['name']  
> > > =\> Automobile showroom. If i search 'Auto_' Elastic returns me only  
> > > "Automobile" and "Automobile showroom", but not 'Auto'. When i'am using  
> > > english versions of this words everything workes fine.
> > > 
> > > Here is some settings. (Elastica client used, looks simple, but if that  
> > > need i can comment some rows).
> > > 
> > > public static $\_elastica = array(  
> > > 'number\_of\_shards' =\> 4,  
> > > 'number\_of\_replicas' =\> 1,  
> > > 'analysis' =\> array(  
> > > 'analyzer' =\> array(  
> > > 'indexAnalyzer' =\> array(  
> > > 'type' =\> 'custom',  
> > > 'tokenizer' =\> 'standard',  
> > > 'filter' =\> array('lowercase', 'mySnowball')  
> > > ),  
> > > 'searchAnalyzer' =\> array(  
> > > 'type' =\> 'custom',  
> > > 'tokenizer' =\> 'standard',  
> > > 'filter' =\> array('lowercase', 'mySnowball', 'stop')  
> > > )  
> > > ),  
> > > 'filter' =\> array(  
> > > 'mySnowball' =\> array(  
> > > 'type' =\> 'snowball',  
> > > 'language' =\> 'russian',  
> > > ),  
> > > 'stop' =\> array(  
> > > 'type' =\> 'stop',  
> > > 'stopwords' =\>  
> > > 'а,без,более,бы,был,была,были,было,быть,в,вам,вас,весь,во,вот,все,всего,всех,вы,где,да,даже,для,до,его,ее,если,есть,еще,же,за,здесь,и,из,или,им,их,к,как,ко,когда,кто,ли,либо,мне,может,мы,на,надо,наш,не,него,нее,нет,ни,них,но,ну,о,об,однако,он,она,они,оно,от,очень,по,под,при,с,со,так,также,такой,там,те,тем,то,того,тоже,той,только,том,ты,у,уже,хотя,чего,чей,чем,что,чтобы,чье,чья,эта,эти,это,я',  
> > > )  
> > > )  
> > > )  
> > > );
> > > 
> > > //Here we set it to index  
> > > $index-\>create(self::$\_elastica, true);
> > > 
> > > //And here is when we creating a document  
> > > $mapping = new Elastica\_Type\_Mapping($type, self::$\_elastica);  
> > > $mapping-\>setProperties(self::$\_elasticaMapping);  
> > > $mapping-\>setParam('index\_analyzer', 'indexAnalyzer');  
> > > $mapping-\>setParam('search\_analyzer', 'searchAnalyzer');  
> > > $mapping-\>send();
> > > 
> > > //This is a search field mapping  
> > > 'name' =\> array('type' =\> 'string', '\_analyzer' =\> array('path' =\>  
> > > 'mySnowball'))
> > > 
> > > //And here is a search query  
> > > $query = new Elastica\_Query\_QueryString('Авто\*');  
> > > $query-\>setAnalyzer('searchAnalyzer');

---

<div class="post-metadata">

### Author: ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)
#### Post date: [March 13, 2012, 5:38pm UTC](https://discuss.elastic.co/t/querystring/6978/6 "2012-03-13T17:38:39Z")

</div>

Russian Snowball Analyzer is basically  
this: [Russian stemming algorithm](http://snowball.tartarus.org/algorithms/russian/stemmer.html) In my  
opinion, this rule-based approach is simply not adequate for such  
morphologically complex language as Russian. You need to look into  
something dictionary-based. I am not working with Russian text at the  
moment and cannot recommend any specific analyzer. You might want to take a  
look at something like this [Google Code Archive - Long-term storage for Google Code Project Hosting.](http://code.google.com/p/russianmorphology/) .  
If it works for you, I can help you stitching it with elasticsearch.

On Tuesday, March 13, 2012 1:03:26 PM UTC-4, k4Rla wrote:

> oh, i didn't saw that analize\_wildcard is false, my bad, now it's works  
> perfect, thank you very much, but how to be with 'Автомобиль'? Have russian  
> snowball some morfology?
> 
> On Tuesday, March 13, 2012 8:21:20 PM UTC+4, Igor Motov wrote:
> 
> > Yes, if you are using a recent version of elasticsearch, you can  
> > specify analyze\_wildcard:true in your query. (See  
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html))  
> > I think it was added in 0.18.6.
> > 
> > The second problem is caused by the way Russian Snowball analyzer works.  
> > As you can see below "Автомобиль" is translated into "автомобил", while  
> > "Автомобильный туризм" into "автомобильн", "туризм" and "Японские  
> > автомобили" into "японск", "автомоб".
> > 
> > $ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
> > "Автомобиль"
> > 
> > {"tokens":[{"token":"автомобил","start\_offset":0,"end\_offset":10,"type":"","position":1}]}
> > 
> > $ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
> > "Автомобильный туризм"
> > 
> > {"tokens":[{"token":"автомобильн","start\_offset":0,"end\_offset":13,"type":"","position":1},{"token":"туризм","start\_offset":14,"end\_offset":20,"type":"","position":2}]}
> > 
> > $ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
> > "Японские автомобили"  
> > {"tokens":[{"token":"японск","start\_offset":0,"end\_offset":8,"type":"","position":1},{"token":"автомоб","start\_offset":9,"end\_offset":19,"type":"","position":2}]}%
> > 
> > On Tuesday, March 13, 2012 12:06:27 PM UTC-4, k4Rla wrote:
> > 
> > > Thank you for answer, any chance to resolve it? I need to request  
> > > "Авто", and get results, that match for "Авто\*". And another one  
> > > question, when i'm searching for 'Автомобиль', it returns me "Автомобильный  
> > > туризм", but not "Японские автомобили", is this same reason?
> > > 
> > > On Tuesday, March 13, 2012 6:46:42 PM UTC+4, k4Rla wrote:
> > > 
> > > > Hi, here is problem with QueryString search in cyrillic using Snowball.  
> > > > When i'm search some word using _, Elastic returns no results, where this  
> > > > word matches, it returns me only results with length, longer than query  
> > > > word length. For example. I have query word Auto (in russian Авто) and  
> > > > documents with \_source ['name'] =\> Auto, ['name'] =\> Automobile, ['name']  
> > > > =\> Automobile showroom. If i search 'Auto_' Elastic returns me only  
> > > > "Automobile" and "Automobile showroom", but not 'Auto'. When i'am using  
> > > > english versions of this words everything workes fine.
> > > > 
> > > > Here is some settings. (Elastica client used, looks simple, but if that  
> > > > need i can comment some rows).
> > > > 
> > > > public static $\_elastica = array(  
> > > > 'number\_of\_shards' =\> 4,  
> > > > 'number\_of\_replicas' =\> 1,  
> > > > 'analysis' =\> array(  
> > > > 'analyzer' =\> array(  
> > > > 'indexAnalyzer' =\> array(  
> > > > 'type' =\> 'custom',  
> > > > 'tokenizer' =\> 'standard',  
> > > > 'filter' =\> array('lowercase', 'mySnowball')  
> > > > ),  
> > > > 'searchAnalyzer' =\> array(  
> > > > 'type' =\> 'custom',  
> > > > 'tokenizer' =\> 'standard',  
> > > > 'filter' =\> array('lowercase', 'mySnowball', 'stop')  
> > > > )  
> > > > ),  
> > > > 'filter' =\> array(  
> > > > 'mySnowball' =\> array(  
> > > > 'type' =\> 'snowball',  
> > > > 'language' =\> 'russian',  
> > > > ),  
> > > > 'stop' =\> array(  
> > > > 'type' =\> 'stop',  
> > > > 'stopwords' =\>  
> > > > 'а,без,более,бы,был,была,были,было,быть,в,вам,вас,весь,во,вот,все,всего,всех,вы,где,да,даже,для,до,его,ее,если,есть,еще,же,за,здесь,и,из,или,им,их,к,как,ко,когда,кто,ли,либо,мне,может,мы,на,надо,наш,не,него,нее,нет,ни,них,но,ну,о,об,однако,он,она,они,оно,от,очень,по,под,при,с,со,так,также,такой,там,те,тем,то,того,тоже,той,только,том,ты,у,уже,хотя,чего,чей,чем,что,чтобы,чье,чья,эта,эти,это,я',  
> > > > )  
> > > > )  
> > > > )  
> > > > );
> > > > 
> > > > //Here we set it to index  
> > > > $index-\>create(self::$\_elastica, true);
> > > > 
> > > > //And here is when we creating a document  
> > > > $mapping = new Elastica\_Type\_Mapping($type, self::$\_elastica);  
> > > > $mapping-\>setProperties(self::$\_elasticaMapping);  
> > > > $mapping-\>setParam('index\_analyzer', 'indexAnalyzer');  
> > > > $mapping-\>setParam('search\_analyzer', 'searchAnalyzer');  
> > > > $mapping-\>send();
> > > > 
> > > > //This is a search field mapping  
> > > > 'name' =\> array('type' =\> 'string', '\_analyzer' =\> array('path' =\>  
> > > > 'mySnowball'))
> > > > 
> > > > //And here is a search query  
> > > > $query = new Elastica\_Query\_QueryString('Авто\*');  
> > > > $query-\>setAnalyzer('searchAnalyzer');

---

<div class="post-metadata">

### Author: ![k4Rla](https://avatars.discourse-cdn.com/v4/letter/k/41988e/32.png) [@k4Rla](https://discuss.elastic.co/u/k4Rla)
#### Post date: [March 13, 2012, 6:32pm UTC](https://discuss.elastic.co/t/querystring/6978/7 "2012-03-13T18:32:31Z")

</div>

Thats exactly what i need, it would be simply wonderful if you could help  
me to stitch this with Elastic!

On Tuesday, March 13, 2012 9:38:39 PM UTC+4, Igor Motov wrote:

> Russian Snowball Analyzer is basically this:  
> [Russian stemming algorithm](http://snowball.tartarus.org/algorithms/russian/stemmer.html) In my  
> opinion, this rule-based approach is simply not adequate for such  
> morphologically complex language as Russian. You need to look into  
> something dictionary-based. I am not working with Russian text at the  
> moment and cannot recommend any specific analyzer. You might want to take a  
> look at something like this [Google Code Archive - Long-term storage for Google Code Project Hosting.](http://code.google.com/p/russianmorphology/) .  
> If it works for you, I can help you stitching it with elasticsearch.
> 
> On Tuesday, March 13, 2012 1:03:26 PM UTC-4, k4Rla wrote:
> 
> > oh, i didn't saw that analize\_wildcard is false, my bad, now it's works  
> > perfect, thank you very much, but how to be with 'Автомобиль'? Have russian  
> > snowball some morfology?
> > 
> > On Tuesday, March 13, 2012 8:21:20 PM UTC+4, Igor Motov wrote:
> > 
> > > Yes, if you are using a recent version of elasticsearch, you can  
> > > specify analyze\_wildcard:true in your query. (See  
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html))  
> > > I think it was added in 0.18.6.
> > > 
> > > The second problem is caused by the way Russian Snowball analyzer works.  
> > > As you can see below "Автомобиль" is translated into "автомобил", while  
> > > "Автомобильный туризм" into "автомобильн", "туризм" and "Японские  
> > > автомобили" into "японск", "автомоб".
> > > 
> > > $ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
> > > "Автомобиль"
> > > 
> > > {"tokens":[{"token":"автомобил","start\_offset":0,"end\_offset":10,"type":"","position":1}]}
> > > 
> > > $ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
> > > "Автомобильный туризм"
> > > 
> > > {"tokens":[{"token":"автомобильн","start\_offset":0,"end\_offset":13,"type":"","position":1},{"token":"туризм","start\_offset":14,"end\_offset":20,"type":"","position":2}]}
> > > 
> > > $ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
> > > "Японские автомобили"  
> > > {"tokens":[{"token":"японск","start\_offset":0,"end\_offset":8,"type":"","position":1},{"token":"автомоб","start\_offset":9,"end\_offset":19,"type":"","position":2}]}%
> > > 
> > > On Tuesday, March 13, 2012 12:06:27 PM UTC-4, k4Rla wrote:
> > > 
> > > > Thank you for answer, any chance to resolve it? I need to request  
> > > > "Авто", and get results, that match for "Авто\*". And another one  
> > > > question, when i'm searching for 'Автомобиль', it returns me "Автомобильный  
> > > > туризм", but not "Японские автомобили", is this same reason?
> > > > 
> > > > On Tuesday, March 13, 2012 6:46:42 PM UTC+4, k4Rla wrote:
> > > > 
> > > > > Hi, here is problem with QueryString search in cyrillic using  
> > > > > Snowball. When i'm search some word using _, Elastic returns no results,  
> > > > > where this word matches, it returns me only results with length, longer  
> > > > > than query word length. For example. I have query word Auto (in russian  
> > > > > Авто) and documents with \_source ['name'] =\> Auto, ['name'] =\>  
> > > > > Automobile, ['name'] =\> Automobile showroom. If i search 'Auto_' Elastic  
> > > > > returns me only "Automobile" and "Automobile showroom", but not 'Auto'.  
> > > > > When i'am using english versions of this words everything workes fine.
> > > > > 
> > > > > Here is some settings. (Elastica client used, looks simple, but if  
> > > > > that need i can comment some rows).
> > > > > 
> > > > > public static $\_elastica = array(  
> > > > > 'number\_of\_shards' =\> 4,  
> > > > > 'number\_of\_replicas' =\> 1,  
> > > > > 'analysis' =\> array(  
> > > > > 'analyzer' =\> array(  
> > > > > 'indexAnalyzer' =\> array(  
> > > > > 'type' =\> 'custom',  
> > > > > 'tokenizer' =\> 'standard',  
> > > > > 'filter' =\> array('lowercase', 'mySnowball')  
> > > > > ),  
> > > > > 'searchAnalyzer' =\> array(  
> > > > > 'type' =\> 'custom',  
> > > > > 'tokenizer' =\> 'standard',  
> > > > > 'filter' =\> array('lowercase', 'mySnowball', 'stop')  
> > > > > )  
> > > > > ),  
> > > > > 'filter' =\> array(  
> > > > > 'mySnowball' =\> array(  
> > > > > 'type' =\> 'snowball',  
> > > > > 'language' =\> 'russian',  
> > > > > ),  
> > > > > 'stop' =\> array(  
> > > > > 'type' =\> 'stop',  
> > > > > 'stopwords' =\>  
> > > > > 'а,без,более,бы,был,была,были,было,быть,в,вам,вас,весь,во,вот,все,всего,всех,вы,где,да,даже,для,до,его,ее,если,есть,еще,же,за,здесь,и,из,или,им,их,к,как,ко,когда,кто,ли,либо,мне,может,мы,на,надо,наш,не,него,нее,нет,ни,них,но,ну,о,об,однако,он,она,они,оно,от,очень,по,под,при,с,со,так,также,такой,там,те,тем,то,того,тоже,той,только,том,ты,у,уже,хотя,чего,чей,чем,что,чтобы,чье,чья,эта,эти,это,я',  
> > > > > )  
> > > > > )  
> > > > > )  
> > > > > );
> > > > > 
> > > > > //Here we set it to index  
> > > > > $index-\>create(self::$\_elastica, true);
> > > > > 
> > > > > //And here is when we creating a document  
> > > > > $mapping = new Elastica\_Type\_Mapping($type, self::$\_elastica);  
> > > > > $mapping-\>setProperties(self::$\_elasticaMapping);  
> > > > > $mapping-\>setParam('index\_analyzer', 'indexAnalyzer');  
> > > > > $mapping-\>setParam('search\_analyzer', 'searchAnalyzer');  
> > > > > $mapping-\>send();
> > > > > 
> > > > > //This is a search field mapping  
> > > > > 'name' =\> array('type' =\> 'string', '\_analyzer' =\> array('path' =\>  
> > > > > 'mySnowball'))
> > > > > 
> > > > > //And here is a search query  
> > > > > $query = new Elastica\_Query\_QueryString('Авто\*');  
> > > > > $query-\>setAnalyzer('searchAnalyzer');

---

<div class="post-metadata">

### Author: ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)
#### Post date: [March 14, 2012, 2:12am UTC](https://discuss.elastic.co/t/querystring/6978/8 "2012-03-14T02:12:05Z")

</div>

Here you go [GitHub - imotov/elasticsearch-analysis-morphology: Morphological Analysis Plugin for ElasticSearch (No longer maintained)](https://github.com/imotov/elasticsearch-analysis-morphology)

On Tuesday, March 13, 2012 2:32:31 PM UTC-4, k4Rla wrote:

> Thats exactly what i need, it would be simply wonderful if you could help  
> me to stitch this with Elastic!
> 
> On Tuesday, March 13, 2012 9:38:39 PM UTC+4, Igor Motov wrote:
> 
> > Russian Snowball Analyzer is basically this:  
> > [Russian stemming algorithm](http://snowball.tartarus.org/algorithms/russian/stemmer.html) In my  
> > opinion, this rule-based approach is simply not adequate for such  
> > morphologically complex language as Russian. You need to look into  
> > something dictionary-based. I am not working with Russian text at the  
> > moment and cannot recommend any specific analyzer. You might want to take a  
> > look at something like this [Google Code Archive - Long-term storage for Google Code Project Hosting.](http://code.google.com/p/russianmorphology/). If it works for you, I can help you stitching it with elasticsearch.
> > 
> > On Tuesday, March 13, 2012 1:03:26 PM UTC-4, k4Rla wrote:
> > 
> > > oh, i didn't saw that analize\_wildcard is false, my bad, now it's works  
> > > perfect, thank you very much, but how to be with 'Автомобиль'? Have russian  
> > > snowball some morfology?
> > > 
> > > On Tuesday, March 13, 2012 8:21:20 PM UTC+4, Igor Motov wrote:
> > > 
> > > > Yes, if you are using a recent version of elasticsearch, you can  
> > > > specify analyze\_wildcard:true in your query. (See  
> > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html))  
> > > > I think it was added in 0.18.6.
> > > > 
> > > > The second problem is caused by the way Russian  
> > > > Snowball analyzer works. As you can see below "Автомобиль" is translated  
> > > > into "автомобил", while "Автомобильный туризм" into "автомобильн", "туризм"  
> > > > and "Японские автомобили" into "японск", "автомоб".
> > > > 
> > > > $ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
> > > > "Автомобиль"
> > > > 
> > > > {"tokens":[{"token":"автомобил","start\_offset":0,"end\_offset":10,"type":"","position":1}]}
> > > > 
> > > > $ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
> > > > "Автомобильный туризм"
> > > > 
> > > > {"tokens":[{"token":"автомобильн","start\_offset":0,"end\_offset":13,"type":"","position":1},{"token":"туризм","start\_offset":14,"end\_offset":20,"type":"","position":2}]}
> > > > 
> > > > $ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
> > > > "Японские автомобили"  
> > > > {"tokens":[{"token":"японск","start\_offset":0,"end\_offset":8,"type":"","position":1},{"token":"автомоб","start\_offset":9,"end\_offset":19,"type":"","position":2}]}%
> > > > 
> > > > On Tuesday, March 13, 2012 12:06:27 PM UTC-4, k4Rla wrote:
> > > > 
> > > > > Thank you for answer, any chance to resolve it? I need to request  
> > > > > "Авто", and get results, that match for "Авто\*". And another one  
> > > > > question, when i'm searching for 'Автомобиль', it returns me "Автомобильный  
> > > > > туризм", but not "Японские автомобили", is this same reason?
> > > > > 
> > > > > On Tuesday, March 13, 2012 6:46:42 PM UTC+4, k4Rla wrote:
> > > > > 
> > > > > > Hi, here is problem with QueryString search in cyrillic using  
> > > > > > Snowball. When i'm search some word using _, Elastic returns no results,  
> > > > > > where this word matches, it returns me only results with length, longer  
> > > > > > than query word length. For example. I have query word Auto (in russian  
> > > > > > Авто) and documents with \_source ['name'] =\> Auto, ['name'] =\>  
> > > > > > Automobile, ['name'] =\> Automobile showroom. If i search 'Auto_' Elastic  
> > > > > > returns me only "Automobile" and "Automobile showroom", but not 'Auto'.  
> > > > > > When i'am using english versions of this words everything workes fine.
> > > > > > 
> > > > > > Here is some settings. (Elastica client used, looks simple, but if  
> > > > > > that need i can comment some rows).
> > > > > > 
> > > > > > public static $\_elastica = array(  
> > > > > > 'number\_of\_shards' =\> 4,  
> > > > > > 'number\_of\_replicas' =\> 1,  
> > > > > > 'analysis' =\> array(  
> > > > > > 'analyzer' =\> array(  
> > > > > > 'indexAnalyzer' =\> array(  
> > > > > > 'type' =\> 'custom',  
> > > > > > 'tokenizer' =\> 'standard',  
> > > > > > 'filter' =\> array('lowercase', 'mySnowball')  
> > > > > > ),  
> > > > > > 'searchAnalyzer' =\> array(  
> > > > > > 'type' =\> 'custom',  
> > > > > > 'tokenizer' =\> 'standard',  
> > > > > > 'filter' =\> array('lowercase', 'mySnowball', 'stop')  
> > > > > > )  
> > > > > > ),  
> > > > > > 'filter' =\> array(  
> > > > > > 'mySnowball' =\> array(  
> > > > > > 'type' =\> 'snowball',  
> > > > > > 'language' =\> 'russian',  
> > > > > > ),  
> > > > > > 'stop' =\> array(  
> > > > > > 'type' =\> 'stop',  
> > > > > > 'stopwords' =\>  
> > > > > > 'а,без,более,бы,был,была,были,было,быть,в,вам,вас,весь,во,вот,все,всего,всех,вы,где,да,даже,для,до,его,ее,если,есть,еще,же,за,здесь,и,из,или,им,их,к,как,ко,когда,кто,ли,либо,мне,может,мы,на,надо,наш,не,него,нее,нет,ни,них,но,ну,о,об,однако,он,она,они,оно,от,очень,по,под,при,с,со,так,также,такой,там,те,тем,то,того,тоже,той,только,том,ты,у,уже,хотя,чего,чей,чем,что,чтобы,чье,чья,эта,эти,это,я',  
> > > > > > )  
> > > > > > )  
> > > > > > )  
> > > > > > );
> > > > > > 
> > > > > > //Here we set it to index  
> > > > > > $index-\>create(self::$\_elastica, true);
> > > > > > 
> > > > > > //And here is when we creating a document  
> > > > > > $mapping = new Elastica\_Type\_Mapping($type, self::$\_elastica);  
> > > > > > $mapping-\>setProperties(self::$\_elasticaMapping);  
> > > > > > $mapping-\>setParam('index\_analyzer', 'indexAnalyzer');  
> > > > > > $mapping-\>setParam('search\_analyzer', 'searchAnalyzer');  
> > > > > > $mapping-\>send();
> > > > > > 
> > > > > > //This is a search field mapping  
> > > > > > 'name' =\> array('type' =\> 'string', '\_analyzer' =\> array('path' =\>  
> > > > > > 'mySnowball'))
> > > > > > 
> > > > > > //And here is a search query  
> > > > > > $query = new Elastica\_Query\_QueryString('Авто\*');  
> > > > > > $query-\>setAnalyzer('searchAnalyzer');

---

<div class="post-metadata">

### Author: ![k4Rla](https://avatars.discourse-cdn.com/v4/letter/k/41988e/32.png) [@k4Rla](https://discuss.elastic.co/u/k4Rla)
#### Post date: [March 14, 2012, 7:01am UTC](https://discuss.elastic.co/t/querystring/6978/9 "2012-03-14T07:01:24Z")

</div>

Thank you very very much, it's awesome and works exactly as i need!

On Wednesday, March 14, 2012 6:12:05 AM UTC+4, Igor Motov wrote:

> Here you go [GitHub - imotov/elasticsearch-analysis-morphology: Morphological Analysis Plugin for ElasticSearch (No longer maintained)](https://github.com/imotov/elasticsearch-analysis-morphology)
> 
> On Tuesday, March 13, 2012 2:32:31 PM UTC-4, k4Rla wrote:
> 
> > Thats exactly what i need, it would be simply wonderful if you could help  
> > me to stitch this with Elastic!
> > 
> > On Tuesday, March 13, 2012 9:38:39 PM UTC+4, Igor Motov wrote:
> > 
> > > Russian Snowball Analyzer is basically this:  
> > > [Russian stemming algorithm](http://snowball.tartarus.org/algorithms/russian/stemmer.html) In my  
> > > opinion, this rule-based approach is simply not adequate for such  
> > > morphologically complex language as Russian. You need to look into  
> > > something dictionary-based. I am not working with Russian text at the  
> > > moment and cannot recommend any specific analyzer. You might want to take a  
> > > look at something like this [Google Code Archive - Long-term storage for Google Code Project Hosting.](http://code.google.com/p/russianmorphology/). If it works for you, I can help you stitching it with elasticsearch.
> > > 
> > > On Tuesday, March 13, 2012 1:03:26 PM UTC-4, k4Rla wrote:
> > > 
> > > > oh, i didn't saw that analize\_wildcard is false, my bad, now it's works  
> > > > perfect, thank you very much, but how to be with 'Автомобиль'? Have russian  
> > > > snowball some morfology?
> > > > 
> > > > On Tuesday, March 13, 2012 8:21:20 PM UTC+4, Igor Motov wrote:
> > > > 
> > > > > Yes, if you are using a recent version of elasticsearch, you can  
> > > > > specify analyze\_wildcard:true in your query. (See  
> > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html))  
> > > > > I think it was added in 0.18.6.
> > > > > 
> > > > > The second problem is caused by the way Russian  
> > > > > Snowball analyzer works. As you can see below "Автомобиль" is translated  
> > > > > into "автомобил", while "Автомобильный туризм" into "автомобильн", "туризм"  
> > > > > and "Японские автомобили" into "японск", "автомоб".
> > > > > 
> > > > > $ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
> > > > > "Автомобиль"
> > > > > 
> > > > > {"tokens":[{"token":"автомобил","start\_offset":0,"end\_offset":10,"type":"","position":1}]}
> > > > > 
> > > > > $ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
> > > > > "Автомобильный туризм"
> > > > > 
> > > > > {"tokens":[{"token":"автомобильн","start\_offset":0,"end\_offset":13,"type":"","position":1},{"token":"туризм","start\_offset":14,"end\_offset":20,"type":"","position":2}]}
> > > > > 
> > > > > $ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
> > > > > "Японские автомобили"  
> > > > > {"tokens":[{"token":"японск","start\_offset":0,"end\_offset":8,"type":"","position":1},{"token":"автомоб","start\_offset":9,"end\_offset":19,"type":"","position":2}]}%
> > > > > 
> > > > > On Tuesday, March 13, 2012 12:06:27 PM UTC-4, k4Rla wrote:
> > > > > 
> > > > > > Thank you for answer, any chance to resolve it? I need to request  
> > > > > > "Авто", and get results, that match for "Авто\*". And another one  
> > > > > > question, when i'm searching for 'Автомобиль', it returns me "Автомобильный  
> > > > > > туризм", but not "Японские автомобили", is this same reason?
> > > > > > 
> > > > > > On Tuesday, March 13, 2012 6:46:42 PM UTC+4, k4Rla wrote:
> > > > > > 
> > > > > > > Hi, here is problem with QueryString search in cyrillic using  
> > > > > > > Snowball. When i'm search some word using _, Elastic returns no results,  
> > > > > > > where this word matches, it returns me only results with length, longer  
> > > > > > > than query word length. For example. I have query word Auto (in russian  
> > > > > > > Авто) and documents with \_source ['name'] =\> Auto, ['name'] =\>  
> > > > > > > Automobile, ['name'] =\> Automobile showroom. If i search 'Auto_' Elastic  
> > > > > > > returns me only "Automobile" and "Automobile showroom", but not 'Auto'.  
> > > > > > > When i'am using english versions of this words everything workes fine.
> > > > > > > 
> > > > > > > Here is some settings. (Elastica client used, looks simple, but if  
> > > > > > > that need i can comment some rows).
> > > > > > > 
> > > > > > > public static $\_elastica = array(  
> > > > > > > 'number\_of\_shards' =\> 4,  
> > > > > > > 'number\_of\_replicas' =\> 1,  
> > > > > > > 'analysis' =\> array(  
> > > > > > > 'analyzer' =\> array(  
> > > > > > > 'indexAnalyzer' =\> array(  
> > > > > > > 'type' =\> 'custom',  
> > > > > > > 'tokenizer' =\> 'standard',  
> > > > > > > 'filter' =\> array('lowercase', 'mySnowball')  
> > > > > > > ),  
> > > > > > > 'searchAnalyzer' =\> array(  
> > > > > > > 'type' =\> 'custom',  
> > > > > > > 'tokenizer' =\> 'standard',  
> > > > > > > 'filter' =\> array('lowercase', 'mySnowball', 'stop')  
> > > > > > > )  
> > > > > > > ),  
> > > > > > > 'filter' =\> array(  
> > > > > > > 'mySnowball' =\> array(  
> > > > > > > 'type' =\> 'snowball',  
> > > > > > > 'language' =\> 'russian',  
> > > > > > > ),  
> > > > > > > 'stop' =\> array(  
> > > > > > > 'type' =\> 'stop',  
> > > > > > > 'stopwords' =\>  
> > > > > > > 'а,без,более,бы,был,была,были,было,быть,в,вам,вас,весь,во,вот,все,всего,всех,вы,где,да,даже,для,до,его,ее,если,есть,еще,же,за,здесь,и,из,или,им,их,к,как,ко,когда,кто,ли,либо,мне,может,мы,на,надо,наш,не,него,нее,нет,ни,них,но,ну,о,об,однако,он,она,они,оно,от,очень,по,под,при,с,со,так,также,такой,там,те,тем,то,того,тоже,той,только,том,ты,у,уже,хотя,чего,чей,чем,что,чтобы,чье,чья,эта,эти,это,я',  
> > > > > > > )  
> > > > > > > )  
> > > > > > > )  
> > > > > > > );
> > > > > > > 
> > > > > > > //Here we set it to index  
> > > > > > > $index-\>create(self::$\_elastica, true);
> > > > > > > 
> > > > > > > //And here is when we creating a document  
> > > > > > > $mapping = new Elastica\_Type\_Mapping($type, self::$\_elastica);  
> > > > > > > $mapping-\>setProperties(self::$\_elasticaMapping);  
> > > > > > > $mapping-\>setParam('index\_analyzer', 'indexAnalyzer');  
> > > > > > > $mapping-\>setParam('search\_analyzer', 'searchAnalyzer');  
> > > > > > > $mapping-\>send();
> > > > > > > 
> > > > > > > //This is a search field mapping  
> > > > > > > 'name' =\> array('type' =\> 'string', '\_analyzer' =\> array('path' =\>  
> > > > > > > 'mySnowball'))
> > > > > > > 
> > > > > > > //And here is a search query  
> > > > > > > $query = new Elastica\_Query\_QueryString('Авто\*');  
> > > > > > > $query-\>setAnalyzer('searchAnalyzer');

---

<div class="post-metadata">

### Author: ![pavlick](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pavlick/32/535_2.png) [@pavlick](https://discuss.elastic.co/u/pavlick)
#### Post date: [August 15, 2012, 8:47am UTC](https://discuss.elastic.co/t/querystring/6978/10 "2012-08-15T08:47:41Z")

</div>

Is it possible to tune this analyzer for parsing dashed words? By default  
it splits dashed words to parts

среда, 14 марта 2012 г., 6:12:05 UTC+4 пользователь Igor Motov написал:

> Here you go [GitHub - imotov/elasticsearch-analysis-morphology: Morphological Analysis Plugin for ElasticSearch (No longer maintained)](https://github.com/imotov/elasticsearch-analysis-morphology)
> 
> On Tuesday, March 13, 2012 2:32:31 PM UTC-4, k4Rla wrote:
> 
> > Thats exactly what i need, it would be simply wonderful if you could help  
> > me to stitch this with Elastic!
> > 
> > On Tuesday, March 13, 2012 9:38:39 PM UTC+4, Igor Motov wrote:
> > 
> > > Russian Snowball Analyzer is basically this:  
> > > [Russian stemming algorithm](http://snowball.tartarus.org/algorithms/russian/stemmer.html) In my  
> > > opinion, this rule-based approach is simply not adequate for such  
> > > morphologically complex language as Russian. You need to look into  
> > > something dictionary-based. I am not working with Russian text at the  
> > > moment and cannot recommend any specific analyzer. You might want to take a  
> > > look at something like this [Google Code Archive - Long-term storage for Google Code Project Hosting.](http://code.google.com/p/russianmorphology/). If it works for you, I can help you stitching it with elasticsearch.
> > > 
> > > On Tuesday, March 13, 2012 1:03:26 PM UTC-4, k4Rla wrote:
> > > 
> > > > oh, i didn't saw that analize\_wildcard is false, my bad, now it's works  
> > > > perfect, thank you very much, but how to be with 'Автомобиль'? Have russian  
> > > > snowball some morfology?
> > > > 
> > > > On Tuesday, March 13, 2012 8:21:20 PM UTC+4, Igor Motov wrote:
> > > > 
> > > > > Yes, if you are using a recent version of elasticsearch, you can  
> > > > > specify analyze\_wildcard:true in your query. (See  
> > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html))  
> > > > > I think it was added in 0.18.6.
> > > > > 
> > > > > The second problem is caused by the way Russian  
> > > > > Snowball analyzer works. As you can see below "Автомобиль" is translated  
> > > > > into "автомобил", while "Автомобильный туризм" into "автомобильн", "туризм"  
> > > > > and "Японские автомобили" into "японск", "автомоб".
> > > > > 
> > > > > $ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
> > > > > "Автомобиль"
> > > > > 
> > > > > {"tokens":[{"token":"автомобил","start\_offset":0,"end\_offset":10,"type":"","position":1}]}
> > > > > 
> > > > > $ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
> > > > > "Автомобильный туризм"
> > > > > 
> > > > > {"tokens":[{"token":"автомобильн","start\_offset":0,"end\_offset":13,"type":"","position":1},{"token":"туризм","start\_offset":14,"end\_offset":20,"type":"","position":2}]}
> > > > > 
> > > > > $ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
> > > > > "Японские автомобили"  
> > > > > {"tokens":[{"token":"японск","start\_offset":0,"end\_offset":8,"type":"","position":1},{"token":"автомоб","start\_offset":9,"end\_offset":19,"type":"","position":2}]}%
> > > > > 
> > > > > On Tuesday, March 13, 2012 12:06:27 PM UTC-4, k4Rla wrote:
> > > > > 
> > > > > > Thank you for answer, any chance to resolve it? I need to request  
> > > > > > "Авто", and get results, that match for "Авто\*". And another one  
> > > > > > question, when i'm searching for 'Автомобиль', it returns me "Автомобильный  
> > > > > > туризм", but not "Японские автомобили", is this same reason?
> > > > > > 
> > > > > > On Tuesday, March 13, 2012 6:46:42 PM UTC+4, k4Rla wrote:
> > > > > > 
> > > > > > > Hi, here is problem with QueryString search in cyrillic using  
> > > > > > > Snowball. When i'm search some word using _, Elastic returns no results,  
> > > > > > > where this word matches, it returns me only results with length, longer  
> > > > > > > than query word length. For example. I have query word Auto (in russian  
> > > > > > > Авто) and documents with \_source ['name'] =\> Auto, ['name'] =\>  
> > > > > > > Automobile, ['name'] =\> Automobile showroom. If i search 'Auto_' Elastic  
> > > > > > > returns me only "Automobile" and "Automobile showroom", but not 'Auto'.  
> > > > > > > When i'am using english versions of this words everything workes fine.
> > > > > > > 
> > > > > > > Here is some settings. (Elastica client used, looks simple, but if  
> > > > > > > that need i can comment some rows).
> > > > > > > 
> > > > > > > public static $\_elastica = array(  
> > > > > > > 'number\_of\_shards' =\> 4,  
> > > > > > > 'number\_of\_replicas' =\> 1,  
> > > > > > > 'analysis' =\> array(  
> > > > > > > 'analyzer' =\> array(  
> > > > > > > 'indexAnalyzer' =\> array(  
> > > > > > > 'type' =\> 'custom',  
> > > > > > > 'tokenizer' =\> 'standard',  
> > > > > > > 'filter' =\> array('lowercase', 'mySnowball')  
> > > > > > > ),  
> > > > > > > 'searchAnalyzer' =\> array(  
> > > > > > > 'type' =\> 'custom',  
> > > > > > > 'tokenizer' =\> 'standard',  
> > > > > > > 'filter' =\> array('lowercase', 'mySnowball', 'stop')  
> > > > > > > )  
> > > > > > > ),  
> > > > > > > 'filter' =\> array(  
> > > > > > > 'mySnowball' =\> array(  
> > > > > > > 'type' =\> 'snowball',  
> > > > > > > 'language' =\> 'russian',  
> > > > > > > ),  
> > > > > > > 'stop' =\> array(  
> > > > > > > 'type' =\> 'stop',  
> > > > > > > 'stopwords' =\>  
> > > > > > > 'а,без,более,бы,был,была,были,было,быть,в,вам,вас,весь,во,вот,все,всего,всех,вы,где,да,даже,для,до,его,ее,если,есть,еще,же,за,здесь,и,из,или,им,их,к,как,ко,когда,кто,ли,либо,мне,может,мы,на,надо,наш,не,него,нее,нет,ни,них,но,ну,о,об,однако,он,она,они,оно,от,очень,по,под,при,с,со,так,также,такой,там,те,тем,то,того,тоже,той,только,том,ты,у,уже,хотя,чего,чей,чем,что,чтобы,чье,чья,эта,эти,это,я',  
> > > > > > > )  
> > > > > > > )  
> > > > > > > )  
> > > > > > > );
> > > > > > > 
> > > > > > > //Here we set it to index  
> > > > > > > $index-\>create(self::$\_elastica, true);
> > > > > > > 
> > > > > > > //And here is when we creating a document  
> > > > > > > $mapping = new Elastica\_Type\_Mapping($type, self::$\_elastica);  
> > > > > > > $mapping-\>setProperties(self::$\_elasticaMapping);  
> > > > > > > $mapping-\>setParam('index\_analyzer', 'indexAnalyzer');  
> > > > > > > $mapping-\>setParam('search\_analyzer', 'searchAnalyzer');  
> > > > > > > $mapping-\>send();
> > > > > > > 
> > > > > > > //This is a search field mapping  
> > > > > > > 'name' =\> array('type' =\> 'string', '\_analyzer' =\> array('path' =\>  
> > > > > > > 'mySnowball'))
> > > > > > > 
> > > > > > > //And here is a search query  
> > > > > > > $query = new Elastica\_Query\_QueryString('Авто\*');  
> > > > > > > $query-\>setAnalyzer('searchAnalyzer');

--

---

<div class="post-metadata">

### Author: ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)
#### Post date: [August 15, 2012, 1:56pm UTC](https://discuss.elastic.co/t/querystring/6978/11 "2012-08-15T13:56:31Z")

</div>

The morpology analyzer is using standard tokenizer and standard, lowercase,  
and morphology filters. In other words it's defined internally like this:

index.analysis.analyzer.russian\_morphology:  
type: custom  
tokenizer: standard  
filter: standard, lowercase, russian\_morphology

You can create your own analyzer that will contain another tokenizer. For  
example, you can use whitespace tokenizer instead

index.analysis.analyzer.my\_russian\_morphology:  
type: custom  
tokenizer: whitespace  
filter: lowercase, russian\_morphology

If you would like to keep standard tokenizer functionality but you need to  
process dashes in a different way, see discussion  
here: [https://groups.google.com/d/topic/elasticsearch/eZJ7d4g71ZQ/discussion](https://groups.google.com/d/topic/elasticsearch/eZJ7d4g71ZQ/discussion)

On Wednesday, August 15, 2012 4:47:41 AM UTC-4, Павел Суслов wrote:

> Is it possible to tune this analyzer for parsing dashed words? By default  
> it splits dashed words to parts
> 
> среда, 14 марта 2012 г., 6:12:05 UTC+4 пользователь Igor Motov написал:
> 
> > Here you go [GitHub - imotov/elasticsearch-analysis-morphology: Morphological Analysis Plugin for ElasticSearch (No longer maintained)](https://github.com/imotov/elasticsearch-analysis-morphology)
> > 
> > On Tuesday, March 13, 2012 2:32:31 PM UTC-4, k4Rla wrote:
> > 
> > > Thats exactly what i need, it would be simply wonderful if you could  
> > > help me to stitch this with Elastic!
> > > 
> > > On Tuesday, March 13, 2012 9:38:39 PM UTC+4, Igor Motov wrote:
> > > 
> > > > Russian Snowball Analyzer is basically this:  
> > > > [Russian stemming algorithm](http://snowball.tartarus.org/algorithms/russian/stemmer.html) In my  
> > > > opinion, this rule-based approach is simply not adequate for such  
> > > > morphologically complex language as Russian. You need to look into  
> > > > something dictionary-based. I am not working with Russian text at the  
> > > > moment and cannot recommend any specific analyzer. You might want to take a  
> > > > look at something like this [Google Code Archive - Long-term storage for Google Code Project Hosting.](http://code.google.com/p/russianmorphology/). If it works for you, I can help you stitching it with elasticsearch.
> > > > 
> > > > On Tuesday, March 13, 2012 1:03:26 PM UTC-4, k4Rla wrote:
> > > > 
> > > > > oh, i didn't saw that analize\_wildcard is false, my bad, now it's  
> > > > > works perfect, thank you very much, but how to be with 'Автомобиль'? Have  
> > > > > russian snowball some morfology?
> > > > > 
> > > > > On Tuesday, March 13, 2012 8:21:20 PM UTC+4, Igor Motov wrote:
> > > > > 
> > > > > > Yes, if you are using a recent version of elasticsearch, you can  
> > > > > > specify analyze\_wildcard:true in your query. (See  
> > > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/query-string-query.html))  
> > > > > > I think it was added in 0.18.6.
> > > > > > 
> > > > > > The second problem is caused by the way Russian  
> > > > > > Snowball analyzer works. As you can see below "Автомобиль" is translated  
> > > > > > into "автомобил", while "Автомобильный туризм" into "автомобильн", "туризм"  
> > > > > > and "Японские автомобили" into "японск", "автомоб".
> > > > > > 
> > > > > > $ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
> > > > > > "Автомобиль"
> > > > > > 
> > > > > > {"tokens":[{"token":"автомобил","start\_offset":0,"end\_offset":10,"type":"","position":1}]}
> > > > > > 
> > > > > > $ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
> > > > > > "Автомобильный туризм"
> > > > > > 
> > > > > > {"tokens":[{"token":"автомобильн","start\_offset":0,"end\_offset":13,"type":"","position":1},{"token":"туризм","start\_offset":14,"end\_offset":20,"type":"","position":2}]}
> > > > > > 
> > > > > > $ curl "localhost:9200/twitter/\_analyze?analyzer=indexAnalyzer" -d  
> > > > > > "Японские автомобили"  
> > > > > > {"tokens":[{"token":"японск","start\_offset":0,"end\_offset":8,"type":"","position":1},{"token":"автомоб","start\_offset":9,"end\_offset":19,"type":"","position":2}]}%
> > > > > > 
> > > > > > On Tuesday, March 13, 2012 12:06:27 PM UTC-4, k4Rla wrote:
> > > > > > 
> > > > > > > Thank you for answer, any chance to resolve it? I need to request  
> > > > > > > "Авто", and get results, that match for "Авто\*". And another one  
> > > > > > > question, when i'm searching for 'Автомобиль', it returns me "Автомобильный  
> > > > > > > туризм", but not "Японские автомобили", is this same reason?
> > > > > > > 
> > > > > > > On Tuesday, March 13, 2012 6:46:42 PM UTC+4, k4Rla wrote:
> > > > > > > 
> > > > > > > > Hi, here is problem with QueryString search in cyrillic using  
> > > > > > > > Snowball. When i'm search some word using _, Elastic returns no results,  
> > > > > > > > where this word matches, it returns me only results with length, longer  
> > > > > > > > than query word length. For example. I have query word Auto (in russian  
> > > > > > > > Авто) and documents with \_source ['name'] =\> Auto, ['name'] =\>  
> > > > > > > > Automobile, ['name'] =\> Automobile showroom. If i search 'Auto_' Elastic  
> > > > > > > > returns me only "Automobile" and "Automobile showroom", but not 'Auto'.  
> > > > > > > > When i'am using english versions of this words everything workes fine.
> > > > > > > > 
> > > > > > > > Here is some settings. (Elastica client used, looks simple, but if  
> > > > > > > > that need i can comment some rows).
> > > > > > > > 
> > > > > > > > public static $\_elastica = array(  
> > > > > > > > 'number\_of\_shards' =\> 4,  
> > > > > > > > 'number\_of\_replicas' =\> 1,  
> > > > > > > > 'analysis' =\> array(  
> > > > > > > > 'analyzer' =\> array(  
> > > > > > > > 'indexAnalyzer' =\> array(  
> > > > > > > > 'type' =\> 'custom',  
> > > > > > > > 'tokenizer' =\> 'standard',  
> > > > > > > > 'filter' =\> array('lowercase', 'mySnowball')  
> > > > > > > > ),  
> > > > > > > > 'searchAnalyzer' =\> array(  
> > > > > > > > 'type' =\> 'custom',  
> > > > > > > > 'tokenizer' =\> 'standard',  
> > > > > > > > 'filter' =\> array('lowercase', 'mySnowball', 'stop')  
> > > > > > > > )  
> > > > > > > > ),  
> > > > > > > > 'filter' =\> array(  
> > > > > > > > 'mySnowball' =\> array(  
> > > > > > > > 'type' =\> 'snowball',  
> > > > > > > > 'language' =\> 'russian',  
> > > > > > > > ),  
> > > > > > > > 'stop' =\> array(  
> > > > > > > > 'type' =\> 'stop',  
> > > > > > > > 'stopwords' =\>  
> > > > > > > > 'а,без,более,бы,был,была,были,было,быть,в,вам,вас,весь,во,вот,все,всего,всех,вы,где,да,даже,для,до,его,ее,если,есть,еще,же,за,здесь,и,из,или,им,их,к,как,ко,когда,кто,ли,либо,мне,может,мы,на,надо,наш,не,него,нее,нет,ни,них,но,ну,о,об,однако,он,она,они,оно,от,очень,по,под,при,с,со,так,также,такой,там,те,тем,то,того,тоже,той,только,том,ты,у,уже,хотя,чего,чей,чем,что,чтобы,чье,чья,эта,эти,это,я',  
> > > > > > > > )  
> > > > > > > > )  
> > > > > > > > )  
> > > > > > > > );
> > > > > > > > 
> > > > > > > > //Here we set it to index  
> > > > > > > > $index-\>create(self::$\_elastica, true);
> > > > > > > > 
> > > > > > > > //And here is when we creating a document  
> > > > > > > > $mapping = new Elastica\_Type\_Mapping($type, self::$\_elastica);  
> > > > > > > > $mapping-\>setProperties(self::$\_elasticaMapping);  
> > > > > > > > $mapping-\>setParam('index\_analyzer', 'indexAnalyzer');  
> > > > > > > > $mapping-\>setParam('search\_analyzer', 'searchAnalyzer');  
> > > > > > > > $mapping-\>send();
> > > > > > > > 
> > > > > > > > //This is a search field mapping  
> > > > > > > > 'name' =\> array('type' =\> 'string', '\_analyzer' =\> array('path' =\>  
> > > > > > > > 'mySnowball'))
> > > > > > > > 
> > > > > > > > //And here is a search query  
> > > > > > > > $query = new Elastica\_Query\_QueryString('Авто\*');  
> > > > > > > > $query-\>setAnalyzer('searchAnalyzer');

--

---

<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:16am UTC](https://discuss.elastic.co/t/querystring/6978/12 "2017-07-06T03:16:16Z")

</div>


