Unable to search few keywords


(pavan chinta) #1

I am unable to search few assets with below keyword.

mountains, this is not picking up mountain.

Already i created search analyser as below on assets by seeing documentation.

http://localhost:9200/assets

{
"settings": {
"analysis" : {
"analyzer" : {
"my_analyzer" : {
"tokenizer" : "standard",
"filter" : ["standard", "lowercase", "my_stemmer"]
}
},
"filter" : {
"my_stemmer" : {
"type" : "stemmer",
"name" : "english"
}
}
}
}
}

Suggest me how to implement this ?

I queried back with below request.

{
"query":{
"bool":{
"must":[
{
"query_string":{
"default_field":"_all",
"query":"mountains*",
"analyzer":"my_analyzer"
}
}
]
}
}
}


Unable to search few words -- Elastic search
(pavan chinta) #2

Appreciate if some one throw some light on this, i am new to elastic search.
Though i set language analyzer it did not works for me.


(Mark Walkom) #3

You should test your analysis chain to make sure that the stemming is correct, that would be the first place to start :slight_smile:


(pavan chinta) #4

Thanks Warkolm for your response.

I can able to search Mountain with below request, But if i want to return assets with Mountains* can i send multiple string or what was the approch ?

{
"query":{
"bool":{
"must":[
{
"query_string":{
"default_field":"_all",
"query":"Mountains",
"analyzer":"my_analyzer"
}
}
]
}
}
}


(Mark Walkom) #5

I don't think a stemming analyser will remove things like non-alpha characters in a query. You should use complete terms.


(pavan chinta) #6

If i place * with query string it is only return data with Mountains* excluded Mountain related assets.


(pavan chinta) #8

Hi Warkolm,

I tested all the analyzers and tokenizers but unable to found solution.

If query is mountains* it is returning mountains only and leaving mountain asset .


(pavan chinta) #9

Finally i can able to solve this by multiple query's.

{
"query": {
"bool": {
"must": [{
"bool": {
"should": [{
"query_string": {
"default_field": "_all",
"query": "Flowers*"
}
}, {
"query_string": {
"default_field": "_all",
"query": "Flowers",
"analyzer":"my_analyzer"
}
}]
}
}]
}
}
}


(system) #10

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