Return score in multiple fields

2014-10-20 Thread Kruti Shukla
Hello All,

I'm trying achieve one functionality in Elasticsearch but I'm not able to 
do it.

In SQL we can do it like --> select SET score_1 = _score from sometable

I trying to assign value of score in one field. That means Elastic search 
will return 2 columns having same values _score and _score1.

I have already tried custom score but it changes the value of _score column 
it self.I DO NOT WANT TO CHANGE . 
I'm already happy with the score returned in "_score"  field.
I want to have same value of "_score" column in another column for example 
"score_1". 

I want to do same in Elasticsearch.

Is it possible? Is there any functionality provided in elasticsearch?

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/a8a22823-593f-40f3-8ab6-eb6da2bc85c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Set _score field value in Elasticsearch

2014-10-17 Thread Kruti Shukla
Hello All,

I'm trying achieve one functionality in Elasticsearch but I'm not able to 
do it.

In SQL we can do it like --> select SET score_1 = _score from sometable

I trying to assign value of score in one field. That means Elastic search 
will return 2 columns having same values _score and _score1.

I have already tried custom score but it changes the value of _score column 
it self.I DO NOT WANT TO CHANGE . 
I'm already happy with the score returned in "_score"  field.
I want to have same value of "_score" column in another column for example 
"score_1". 

I want to do same in Elasticsearch.

Is it possible? Is there any functionality provided in elasticsearch?


-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/59487bae-f12b-42dd-b193-71422f48fcce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: snowball analyzer not working

2014-05-19 Thread Kruti Shukla
Is there anyone who can help? Please?

On Friday, May 16, 2014 6:47:55 AM UTC-4, Kruti Shukla wrote:
>
> Hi All,
> I want to search document in following order -->
>
> 1. men's foil shaver
> 2. men's foils shaver
> 3. men's foil advanced shaver
>
> I tried multi-field option while mapping the field and mapped it with 
> different filters and analyzers like one index with "not_analyzed",one with 
> "snow ball analyzer", one with "stemmer -- minimul english", "standard", 
> whitespace" analyzer and one with ngram having min ngram 3 and max nagram 
> 10. None of them works for me.
> Major part of the problem is if I search for "men's foil shaver" then all 
> of them have same score of I CANNOT re-sequence them.
>
> I'm getting:
> 1. men's foil shaver
> 3. men's foil advanced shaver
> 2. men's foils shaver
>
> expected result:
> 1. men's foil shaver
> 2. men's foils shaver -- zero word distance with 1 plural "foil --> foils"
> 3. men's foil advanced shaver --1 word distance with no plural.
>
> Please suggest. Any help?
>
> I have posted kind of same 
> question<https://groups.google.com/forum/#!topic/elasticsearch/ui9OR7JARs4> 
> before 
> but I did not reach to answer. I'm still waiting on my answers for that.
> one more question I have posted before few weeks: 
> https://groups.google.com/forum/#!searchin/elasticsearch/plural/elasticsearch/ET-S3SCD22I/zFyErGO4SRcJ
> .
> Suggestion did improve my problem but it is not solved yet.
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/ee9dc086-3443-4f32-aec8-63bb271d328c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


snowball analyzer not working

2014-05-16 Thread Kruti Shukla
Hi All,
I want to search document in following order -->

1. men's foil shaver
2. men's foils shaver
3. men's foil advanced shaver

I tried multi-field option while mapping the field and mapped it with 
different filters and analyzers like one index with "not_analyzed",one with 
"snow ball analyzer", one with "stemmer -- minimul english", "standard", 
whitespace" analyzer and one with ngram having min ngram 3 and max nagram 
10. None of them works for me.
Major part of the problem is if I search for "men's foil shaver" then all 
of them have same score of I CANNOT re-sequence them.

I'm getting:
1. men's foil shaver
3. men's foil advanced shaver
2. men's foils shaver

expected result:
1. men's foil shaver
2. men's foils shaver -- zero word distance with 1 plural "foil --> foils"
3. men's foil advanced shaver --1 word distance with no plural.

Please suggest. Any help?

I have posted kind of same 
question 
before 
but I did not reach to answer. I'm still waiting on my answers for that.
one more question I have posted before few weeks: 
https://groups.google.com/forum/#!searchin/elasticsearch/plural/elasticsearch/ET-S3SCD22I/zFyErGO4SRcJ
.
Suggestion did improve my problem but it is not solved yet.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/fa97ad24-c5e1-40a4-9962-15b98bdcbe01%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Newbie, basic search help

2014-05-13 Thread Kruti Shukla
I have problem with plurals and want to more relevance in the search. 
please look at my question 
here: https://groups.google.com/d/msg/elasticsearch/8yjfx2HLelc/2bEuar6NT9YJ. 
Thank you.
Please help or suggest. Thank you for your time. 

On Tuesday, September 3, 2013 8:54:41 AM UTC-4, MArk Williams wrote:
>
> Hi, new to all this ES and overwhelmed by all the options and syntax.
> I (currently) only have 2 fields, company name and company number. I want 
> to search company names.
> I have a a really simple search to do and cannot get the order I want (or 
> would expect)
> I set up like:-
> curl -XPOST 'http://localhost:9200/playcompany'
> then run a bunch of :-
> curl -XPOST 'http://localhost:9200/playcompany/companies/' -d '{ "number" 
> : "06026916", "name" : "FRASERS VENTURES LIMITED" }'
> curl -XPOST 'http://localhost:9200/playcompany/companies/' -d '{ "number" 
> : "01366799", "name" : "SUPPORT SERVICES LIMITED" }'
> curl -XPOST 'http://localhost:9200/playcompany/companies/' -d '{ "number" 
> : "01349558", "name" : "MCGINLEY SUPPORT SERVICES LIMITED" }'
> curl -XPOST 'http://localhost:9200/playcompany/companies/' -d '{ "number" 
> : "01409241", "name" : "SUPPORT SERVICES (FILMS) LIMITED" }'
> curl -XPOST 'http://localhost:9200/playcompany/companies/' -d '{ "number" 
> : "01470672", "name" : "A.C.S. (CONSULTANCY AND SUPPORT SERVICES) LIMITED" 
> }'
> curl -XPOST 'http://localhost:9200/playcompany/companies/' -d '{ "number" 
> : "01475234", "name" : "GENERAL SUPPORT AND HANDLING SERVICES LIMITED" }'
> curl -XPOST 'http://localhost:9200/playcompany/companies/' -d '{ "number" 
> : "02795677", "name" : "SUPPORT SERVICES LIMITED" }'
> etc
> to load up only 127 for testing. Mapping shows:-
>
> curl -XGET 'http://localhost:9200/playcompany/companies/_mapping?pretty'
> {
>   "companies" : {
> "properties" : {
>   "name" : {
> "type" : "string"
>   },
>   "number" : {
> "type" : "string"
>   }
> }
>   }
> }
>
> ALL I need is sensible matches, matches that humans would expect, in an 
> order that humans would expect.
> when I do a simple  :-
> curl -XGET '
> http://localhost:9200/playcompany/companies/_search?q=name:support%20services%20limited&pretty=true
> '
> I would hope to get "SUPPORT SERVICES LIMITED" as the first hit, followed 
> by other 'relevant' results, in some sort of explainable order.
>  'relevant' to me (or human searchers) means that the more words that 
> match, the more relevant. so 3 out of 3 words match should be the top, 3 
> out of 4 also pretty relevant. 3 words matched out of 6 words for example 
> are deemed less relevant. 
> I would hope to also like to match plurals and common endings, so I would 
> like a search for "SUPPORT SERVICES LIMITED" to also match "SUPPORT SERVICE 
> LIMITED" (singular) , but not as high as the exact match "SUPPORT SERVICES 
> LIMITED".
> hope this makes sense. With only 10 or so names loaded, I get mostlt what 
> I want, but as soon as I load up over 100, the order goes out the window 
> and the _score values are all the same after the first 2 or 3 matches.
>
> How do I do this?
> Sorry this is such a long post, first one and not sure where to start.
> Any help (more importantly examples that I can copy and paste to try out) 
> would be invaluable.
> Thanks for you time, appreciated.
> MArk Williams
>
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/351d3f11-4acf-4385-97e9-dcd2575308e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Return result same score problem, any option to re-sequence return result order?

2014-05-13 Thread Kruti Shukla
one more question I have posted before few weeks but no suggestion 
worked: 
https://groups.google.com/forum/#!searchin/elasticsearch/plural/elasticsearch/ET-S3SCD22I/zFyErGO4SRcJ

On Tuesday, May 13, 2014 8:22:55 AM UTC-4, Kruti Shukla wrote:
>
> Hi All,
> I want to search document in following order -->
>
> 1. men's foil shaver
> 2. men's foils shaver
> 3. men's foil advanced shaver
>
> I tried multi-field option while mapping the field and mapped it with 
> different filters and analyzers like one index with "not_analyzed",one with 
> "snow ball analyzer", one with "stemmer -- minimul english", "standard", 
> whitespace" analyzer and one with ngram having min ngram 3 and max nagram 
> 10. None of them works for me.
> Major part of the problem is if I search for "men's foil shaver" then all 
> of them have same score of I CANNOT re-sequence them.
>
> I'm getting:
> 1. men's foil shaver
> 3. men's foil advanced shaver
> 2. men's foils shaver
>
> expected result:
> 1. men's foil shaver
> 2. men's foils shaver -- zero word distance with 1 plural "foil --> foils"
> 3. men's foil advanced shaver --1 word distance with no plural.
>
> Please suggest. Any help?
>
> I have posted kind of same 
> question<https://groups.google.com/forum/#!topic/elasticsearch/ui9OR7JARs4> 
> before 
> but I did not reach to answer. I'm still waiting on my answers for that.
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/41b396db-f9a2-4105-a02e-46d09a8640dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Return result same score problem, any option to re-sequence return result order?

2014-05-13 Thread Kruti Shukla
Hi All,
I want to search document in following order -->

1. men's foil shaver
2. men's foils shaver
3. men's foil advanced shaver

I tried multi-field option while mapping the field and mapped it with 
different filters and analyzers like one index with "not_analyzed",one with 
"snow ball analyzer", one with "stemmer -- minimul english", "standard", 
whitespace" analyzer and one with ngram having min ngram 3 and max nagram 
10. None of them works for me.
Major part of the problem is if I search for "men's foil shaver" then all 
of them have same score of I CANNOT re-sequence them.

I'm getting:
1. men's foil shaver
3. men's foil advanced shaver
2. men's foils shaver

expected result:
1. men's foil shaver
2. men's foils shaver -- zero word distance with 1 plural "foil --> foils"
3. men's foil advanced shaver --1 word distance with no plural.

Please suggest. Any help?

I have posted kind of same 
question 
before 
but I did not reach to answer. I'm still waiting on my answers for that.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/a99548fa-0f7a-4195-834a-2a1895ab9347%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Partial word match with singular and plurals: Elasticsearch

2014-05-02 Thread Kruti Shukla
Any help?
Why higher distance document scored higher?
Is there any problem with stemmer or nGram settings?


On Thursday, May 1, 2014 8:37:09 AM UTC-4, Kruti Shukla wrote:
>
> Hi Radu,
>
> Thank you so for the suggestions. I was knowing mul-field but was not 
> knowing how helpful it can be but now I'm able play with the multi field 
> feature.
> I tried following suggestion and created index and mapping accordingly.
>
> I tried querying for first 2. First one was simple and second one with 
> slop. It is not returning correct slop(i,e, incremental distance). 
> Please help/suggest query improvements.
>
> *Please see my settings below:*
>
> *For index: *
> curl -XPUT "http://localhost:9200/my_improved_index"; -d'
> {
>"settings": {
> "analysis": {
> "filter": {
> "trigrams_filter": {
> "type": "ngram",
> "min_gram": 1,
> "max_gram": 50
> },
>  "my_stemmer" : {
> "type" : "stemmer",
> "name" : "minimal_english"
> }
> },
> "analyzer": {
> "trigrams": {
> "type":  "custom",
> "tokenizer": "standard",
> "filter":   [
> "standard",
> "lowercase",
> "trigrams_filter"
> ]
> },
> "my_stemmer_analyzer":{
> "type":  "custom",
> "tokenizer": "standard",
> "filter":   [
> "standard",
> "lowercase",
> "my_stemmer"
> ]
> }
> }
> }
> }
> }'
>
> *For mappings:*
> curl -XPUT "
> http://localhost:9200/my_improved_index/my_improved_index_type/_mapping"; 
> -d'
> {
> "my_improved_index_type": {
>   "properties": {
>  "name": {
> "type": "multi_field",
> "fields": {
>"name_gram": {
>   "type": "string",
>   "analyzer": "trigrams"
>},
>"untouched": {
>   "type": "string",
>   "index": "not_analyzed"
>},
>"name_stemmer":{
>"type": "string",
>"analyzer": "my_stemmer_analyzer"
>}
> }
>  }
>   }
>}
>
> }'
>
> *Available documents:*
> 1. men’s shaver
> 2. men’s shavers
> 3. men’s foil shaver
> 4. men’s foils shaver
> 5. men’s foil shavers
> 6. men’s foils shavers
> 7.men's foil advanced shaver
> 8.norelco men's foil advanced shaver
>
> *Query:*
> curl -XPOST "
> http://localhost:9200/my_improved_index/my_improved_index_type/_search"; 
> -d'
> {
>"size": 30,
>"query": {
>   "bool": {
>  "should": [
> {
>"match": {
>   "name.untouched": {
>  "query": "men\"s shaver",
>  "operator": "and",
>  "type": "phrase",
>  "boost": "10"
>   }
>}
> },
> {
>"match_phrase": {
>   "name.name_stemmer": {
>  "query": "men\"s shaver",
>  "slop": 5
>   }
>}
> }
>  ]
>   }
>}
> }'
>
> *Returned result:*
> 1. men's shaver --> correct
> 2. men's shavers --> correct
> 3. men's foils shaver --> NOT correct
> 4. norelco men's foil advanced shaver -

Re: Partial word match with singular and plurals: Elasticsearch

2014-05-01 Thread Kruti Shukla
ww.elasticsearch.org/guide/en/elasticsearch/reference/current/_multi_fields.html>,
>  
> where you index them with various settings, like once not-analyzed for 
> exact matches, once with ngrams to account for typoes and so on. You can 
> query all those sub-fields, and use the multi-match query with best 
> fields<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html#type-best-fields>or
>  the DisMax 
> query<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-dis-max-query.html>to
>  wrap all those queries and take the best score (or the best score and a 
> factor of the other scores by using the tie breaker).
>
> Now, for the specific requirements you have:
> 1. For exact matching, you can skip analysis altogether, and set "index" 
> to "not_anyzed". Alternatively, you could use the simple 
> analyzer<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-simple-analyzer.html#analysis-simple-analyzer>
>  or 
> something equally "harmless" to allow for some error. You could boost this 
> kind of query a lot, so that exact matches come out on top
> 2. For phrase matches with distance, you can use the match_phrase type of 
> the match 
> query<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-match-query.html#_phrase>.
>  
> You can configure a *slop* that defines the maximum allowed distance for 
> a match to show up in your results. Documents with "closer" words should 
> get higher scores. You would boost this query less than the exact matches, 
> but more than the following.
> 3. For handling plurals, you'd probably need to do some stemming. Have a 
> look at the snowball token 
> filter<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-snowball-tokenfilter.html>or
>  the stemmer 
> token 
> filter<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-stemmer-tokenfilter.html#analysis-stemmer-tokenfilter>.
>  
> Again, this would be boosted lower than 1) and 2), but more than 4)
> 4. For handling substrings, you can use ngrams, as you already seem to be 
> doing. Alternatively, you can pay the price at query time by using the 
> "fuziness" option of the match query.
>
> Best regards,
> Radu
> --
> Performance Monitoring * Log Analytics * Search Analytics
> Solr & Elasticsearch Support * http://sematext.com/
>  
>
> On Thu, May 1, 2014 at 10:48 AM, Kruti Shukla 
> 
> > wrote:
>
>> *My final goal is to have following search precedence:*
>> 1. Exact phrase match
>> 2. Exact word match with incremental distance
>> 3. Plurals
>> 4. Substring
>>
>> *Suppose I have following documents:*
>> i. men’s shaver
>> ii. men’s shavers
>> iii. men’s foil shaver
>> iv. men’s foils shaver
>> v. men’s foil shavers
>> vi. men’s foils shavers
>>
>> *Case 1: *search for : “men’s foil shaver”
>> *Expected result:*
>> 1. men’s foil shaver <-- exact phrase match
>> 2. men’s foil shavers <-- exact word match on 2 of 3 words with 0 
>> word distance + plural
>> 3. men’s foils shaver <-- exact word match on 2 of 3 words with 1 
>> word distance + plural
>> 4. men’s foils shavers <-- exact word match on 1 of 3 words + 2 
>> plurals
>> 5. men’s shaver <-- exact word match on 2 of 3 words (66% match)
>> 6. men’s shavers <-- exact word match on 1 of 3 words + plural (66% 
>> match)
>>
>> *Case 2: *search for : “men’s foil shavers”
>> *Expected result:*
>> 1. men’s foil shavers <-- exact phrase match
>> 2. men’s foil shaver <-- exact word match on 2 of 3 words with 0 
>> word distance + singular
>> 3. men’s foils shavers <-- exact word match on 2 of 3 words with 1 
>> word distance + singular
>> 4. men’s foils shaver <-- exact word match on 1 of 3 words + 2 
>> singulars
>> 5. men’s shavers <-- exact word match on 2 of 3 words (66% match)
>> 6. men’s shaver <-- exact word match on 1 of 3 words + singular (66% 
>> match)
>>
>>
>> *Case 3:* search for : “men’s foils shavers”
>> *Expected result:*
>> 1. men’s foils shavers <-- exact phrase match
>> 2. men’s foils shaver <-- exact word match on 2 of 3 words with 0 
>> word distance + singular
>> 3. men’s foil shavers <-- exact word match on 2 of 3 words with 1 
>> word distance + singular
>> 4. men’s foil shaver <-- exact word match on 1 of 3 words + 2 
>>

Partial word match with singular and plurals: Elasticsearch

2014-05-01 Thread Kruti Shukla
*My final goal is to have following search precedence:*
1. Exact phrase match
2. Exact word match with incremental distance
3. Plurals
4. Substring

*Suppose I have following documents:*
i. men’s shaver
ii. men’s shavers
iii. men’s foil shaver
iv. men’s foils shaver
v. men’s foil shavers
vi. men’s foils shavers

*Case 1: *search for : “men’s foil shaver”
*Expected result:*
1. men’s foil shaver <-- exact phrase match
2. men’s foil shavers <-- exact word match on 2 of 3 words with 0 word 
distance + plural
3. men’s foils shaver <-- exact word match on 2 of 3 words with 1 word 
distance + plural
4. men’s foils shavers <-- exact word match on 1 of 3 words + 2 plurals
5. men’s shaver <-- exact word match on 2 of 3 words (66% match)
6. men’s shavers <-- exact word match on 1 of 3 words + plural (66% 
match)

*Case 2: *search for : “men’s foil shavers”
*Expected result:*
1. men’s foil shavers <-- exact phrase match
2. men’s foil shaver <-- exact word match on 2 of 3 words with 0 word 
distance + singular
3. men’s foils shavers <-- exact word match on 2 of 3 words with 1 word 
distance + singular
4. men’s foils shaver <-- exact word match on 1 of 3 words + 2 singulars
5. men’s shavers <-- exact word match on 2 of 3 words (66% match)
6. men’s shaver <-- exact word match on 1 of 3 words + singular (66% 
match)


*Case 3:* search for : “men’s foils shavers”
*Expected result:*
1. men’s foils shavers <-- exact phrase match
2. men’s foils shaver <-- exact word match on 2 of 3 words with 0 word 
distance + singular
3. men’s foil shavers <-- exact word match on 2 of 3 words with 1 word 
distance + singular
4. men’s foil shaver <-- exact word match on 1 of 3 words + 2 singulars
5. men’s shavers <-- exact word match on 2 of 3 words (66% match)
6. men’s shaver <-- exact word match on 1 of 3 words + singular (66% 
match)


Is there any way in elasticsearch I can achieve this?
This question is related to my other question which is not answered yet.
Link to my other question "
https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/elasticsearch/ui9OR7JARs4/Mp3oOtTqY0EJ
".

Any suggestion would help!
Thank you.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/c2ead70e-c5d6-4001-87fd-645a16e670dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Substring match in search term order using Elasticsearch

2014-05-01 Thread Kruti Shukla
For following query: 
POST /my_index1/my_type1/_search

{
"query": {
   "match": {
  "text": 
  { "query": "en's shaver",

"minimum_should_match": "100%"

  }
   }

}
}

I'm getting this result set -->
women's shaver
men's foil advanced shaver
women's foil advanced shaver
men's foil shaver
women's foil shaver
norelco men's foil advanced shaver
norelco women's foil advanced shaver
men's shavers

And when I search using below query:

POST /my_index1/my_type1/_search
{
   "query": {
  "query_string": {
 "default_field": "text",
 "query": "men's shaver",
 "minimum_should_match": "90%"
  }
   }
}

I'm getting this result set -->
women's shavers
men's shaver
women's shaver
men's foil advanced shaver
women's foil advanced shaver
men's foil shaver
women's foil shaver
norelco men's foil advanced shaver
norelco women's foil advanced shaver
men's shavers

Which is not correct either. 

I think shigles will not help when I want to search by substring for 
example "en's" shaver.
If you think it can help then can you please post some code that I can give 
me above result using shigle?

On Wednesday, April 30, 2014 3:04:03 PM UTC-4, Ramdev Wudali wrote:
>
> what happens when you query  as you indicated ?
>
> did you try and wildchar query ? Also perhaps  an analyzer with the 
> shingle token filter (
> http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/analysis-shingle-tokenfilter.html#analysis-shingle-tokenfilter<http://www.google.com/url?q=http%3A%2F%2Fwww.elasticsearch.org%2Fguide%2Fen%2Felasticsearch%2Freference%2Fcurrent%2Fanalysis-shingle-tokenfilter.html%23analysis-shingle-tokenfilter&sa=D&sntz=1&usg=AFQjCNGpdJVjC70Brm5eG5zM9E3UNELkJQ>)
>  
> will work better for your purposes ?
>
> Ramdev
>
>
> On Wednesday, 30 April 2014 09:15:35 UTC-5, Kruti Shukla wrote:
>>
>> Posted same question on "stackover flow" 
>> "http://stackoverflow.com/questions/23244796/substring-match-in-search-term-order-using-elasticsearch";
>>  but still looking for Answer.
>>
>>
>> I'm new to elasticsearch
>>
>> I want to perform substring/partial word match using elastic search. I 
>> want results to be returned in the perticular order. In order to explain my 
>> problem I will show you how I create my index, mappings and what are the 
>> records I use.
>>
>> *Creating Index and mappings:*
>>
>> PUT /my_index1
>> {
>> "settings": {
>> "analysis": {
>> "filter": {
>> "trigrams_filter": {
>> "type": "ngram",
>> "min_gram": 3,
>> "max_gram": 3
>> }
>> },
>> "analyzer": {
>> "trigrams": {
>> "type":  "custom",
>> "tokenizer": "standard",
>> "filter":   [
>> "lowercase",
>> "trigrams_filter"
>> ]
>> }
>> }
>> }
>> },
>> "mappings": {
>> "my_type1": {
>> "properties": {
>> "text": {
>> "type": "string",
>> "analyzer": "trigrams" 
>> }
>> }
>> }
>> }
>> }
>>
>> *Bulk record insert:*
>>
>> POST /my_index1/my_type1/_bulk
>> { "index": { "_id": 1 }}
>> { "text": "men's shaver" }
>> { "index": { "_id": 2 }}
>> { "text": "men's foil shaver" }
>> { "index": { "_id": 3 }}
>> { "text": "men's foil advanced shaver" }
>> { "index": { "_id": 4 }}
>> { "text": "norelco men's foil advanced shaver" }
>> { "index": { "_id": 5 }}
>> { "text": "men's shavers" }
>> { "index": { "_id": 6 }}
>> {

Substring match in search term order using Elasticsearch

2014-04-30 Thread Kruti Shukla


Posted same question on "stackover flow" 
"http://stackoverflow.com/questions/23244796/substring-match-in-search-term-order-using-elasticsearch";
 but still looking for Answer.


I'm new to elasticsearch

I want to perform substring/partial word match using elastic search. I want 
results to be returned in the perticular order. In order to explain my 
problem I will show you how I create my index, mappings and what are the 
records I use.

*Creating Index and mappings:*

PUT /my_index1
{
"settings": {
"analysis": {
"filter": {
"trigrams_filter": {
"type": "ngram",
"min_gram": 3,
"max_gram": 3
}
},
"analyzer": {
"trigrams": {
"type":  "custom",
"tokenizer": "standard",
"filter":   [
"lowercase",
"trigrams_filter"
]
}
}
}
},
"mappings": {
"my_type1": {
"properties": {
"text": {
"type": "string",
"analyzer": "trigrams" 
}
}
}
}
}

*Bulk record insert:*

POST /my_index1/my_type1/_bulk
{ "index": { "_id": 1 }}
{ "text": "men's shaver" }
{ "index": { "_id": 2 }}
{ "text": "men's foil shaver" }
{ "index": { "_id": 3 }}
{ "text": "men's foil advanced shaver" }
{ "index": { "_id": 4 }}
{ "text": "norelco men's foil advanced shaver" }
{ "index": { "_id": 5 }}
{ "text": "men's shavers" }
{ "index": { "_id": 6 }}
{ "text": "women's shaver" }
{ "index": { "_id": 7 }}
{ "text": "women's foil shaver" }
{ "index": { "_id": 8 }}
{ "text": "women's foil advanced shaver" }
{ "index": { "_id": 9 }}
{ "text": "norelco women's foil advanced shaver" }
{ "index": { "_id": 10 }}
{ "text": "women's shavers" }

*Now, I want to perform search for "en's shaver". I'm searching using 
follwing query:*

POST /my_index1/my_type1/_search
{
"query": {
   "match": {
  "text": 
  { "query": "en's shaver",

"minimum_should_match": "100%"

  }
   }

}
}

I want results to be in following sequence:

   1. men's shaver --> closest match with following same search keyword 
   order "en's shaver
   2. women's shaver --> closest match with following same search keyword 
   order "en's shaver
   3. men's foil shaver --> increased distance by 1
   4. women's foil shaver --> increased distance by 1
   5. men's foil advanced shaver --> increased distance by 2
   6. women's foil advanced shaver --> increased distance by 2
   7. men's shavers --> substring match for "shavers"
   8. women's shavers --> substring match for "shavers"

I'm performing following query. It is not giving me result in the order I 
want:

POST /my_index1/my_type1/_search
{
   "query": {
  "query_string": {
 "default_field": "text",
 "query": "men's shaver",
 "minimum_should_match": "90%"
  }
   }
}

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/b7d43a2d-be99-45a5-a2a3-4151dbc52292%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.