Re: Completion Suggester : Support for numeric value completion suggestion

2014-08-12 Thread Hemant Singh
Thanks Alexander,

It worked with Standard Analyzer. Will look for different analyzers, and 
chose the best which fits the use case. 

Thanks,
Hemant

On Tuesday, August 12, 2014 2:21:48 PM UTC+5:30, Alexander Reelsen wrote:
>
> Hey,
>
> The default analyzer used in the completion suggester is the simple one, 
> which strips out numbers.
>
>
> --Alex
>
>
> On Thu, Aug 7, 2014 at 1:43 PM, Hemant > 
> wrote:
>
>> Hello, 
>>
>> I was trying the following use cases using completion suggester - 
>> 1. Suggest Song on search song by id - numeric value(long)  - ***
>> 2. Suggest Song by Song Title and 
>> some more use cases, but that does not make any sense for this question. 
>>
>> But I was unable to get the first use case done. 
>>
>> I indexed the song as follows - 
>>
>> curl -X PUT 'localhost:9200/music/song/1?refresh=true' -d '{
>>
>> "name" : "Nevermind",
>>
>> "suggest" : {
>>
>> "input": [ "Nevermind", "Nirvana", "123" ],
>>
>> "output": "Nirvana - Nevermind",
>>
>> "payload" : { "artistId" : 2321 },
>>
>> "weight" : 34
>>
>> }
>> }'
>>
>> curl -X PUT 'localhost:9200/music/song/2?refresh=true' -d '{
>>
>> "name" : "Friday",
>>
>> "suggest" : {
>>
>> "input": [ "Friday", "Rebecca","1456" ],
>>
>> "output": "Nirvana - Nevermind",
>>
>> "payload" : { "artistId" : 2322 },
>>
>> "weight" : 34
>>
>> }
>> }'
>>
>> Now when I query - 
>>
>> curl -X POST 'localhost:9200/music/_suggest?pretty' -d '{
>>
>> "song-suggest" : {
>>
>> "text" : "123",
>>
>> "completion" : {
>>
>> "field" : "suggest"
>>
>> }
>> }
>> }'
>>
>> I expected the following result by the completion search result - 
>>
>> {
>>   "_shards" : {
>> "total" : 5,
>> "successful" : 5,
>> "failed" : 0
>>   },
>>   "song-suggest" : [ {
>> "text" : "123",
>> "offset" : 0,
>> "length" : 3,
>> "options" : [ {
>>   "text" : "Nirvana - Nevermind",
>>   "score" : 34.0, "payload" : {"artistId":2321}
>> } ]
>>   } ]
>> }
>>
>> But did not succeed. 
>>
>> From several attempt came to notice that, numeric value completion 
>> suggester is not yet supported in Elaticsearch. 
>>
>> After reading few forum posts, and Elasticsearch documentation, noticed 
>> that this completion suggester is only for terms which consists only 
>> alphabet, as it is using FST as it's internal data structure. 
>> Elasticsearch : you-complete-me blog 
>> <http://www.elasticsearch.org/blog/you-complete-me/> , 
>> Search-suggesters-completion 
>> article 
>> <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters-completion.html>
>>
>> Correct me, If I have understood something wrongly. 
>>
>> My question is, Will Elasticsearch be supporting numeric value in near 
>> future for completion suggester ?
>> Or is there any way I can use completion suggester for this purpose ?
>>
>> Or suggest me some better alternative to solve this problem. 
>>
>> Thanks,
>> Hemant
>>
>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "elasticsearch" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to elasticsearc...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/elasticsearch/c3b74171-9a1e-4c32-8a4b-2d959390c61b%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/elasticsearch/c3b74171-9a1e-4c32-8a4b-2d959390c61b%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/ab701dd1-0cc7-48dd-b0de-4c8ccc9ef7e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Completion Suggester : Support for numeric value completion suggestion

2014-08-07 Thread Hemant
Hello, 

I was trying the following use cases using completion suggester - 
1. Suggest Song on search song by id - numeric value(long)  - ***
2. Suggest Song by Song Title and 
some more use cases, but that does not make any sense for this question. 

But I was unable to get the first use case done. 

I indexed the song as follows - 

curl -X PUT 'localhost:9200/music/song/1?refresh=true' -d '{
"name" : "Nevermind",
"suggest" : {
"input": [ "Nevermind", "Nirvana", "123" ],
"output": "Nirvana - Nevermind",
"payload" : { "artistId" : 2321 },
"weight" : 34
}
}'

curl -X PUT 'localhost:9200/music/song/2?refresh=true' -d '{
"name" : "Friday",
"suggest" : {
"input": [ "Friday", "Rebecca","1456" ],
"output": "Nirvana - Nevermind",
"payload" : { "artistId" : 2322 },
"weight" : 34
}
}'

Now when I query - 

curl -X POST 'localhost:9200/music/_suggest?pretty' -d '{
"song-suggest" : {
"text" : "123",
"completion" : {
"field" : "suggest"
}
}
}'

I expected the following result by the completion search result - 

{
  "_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
  },
  "song-suggest" : [ {
"text" : "123",
"offset" : 0,
"length" : 3,
"options" : [ {
  "text" : "Nirvana - Nevermind",
  "score" : 34.0, "payload" : {"artistId":2321}
} ]
  } ]
}

But did not succeed. 

>From several attempt came to notice that, numeric value completion 
suggester is not yet supported in Elaticsearch. 

After reading few forum posts, and Elasticsearch documentation, noticed 
that this completion suggester is only for terms which consists only 
alphabet, as it is using FST as it's internal data structure. 
Elasticsearch : you-complete-me blog 
<http://www.elasticsearch.org/blog/you-complete-me/> , 
Search-suggesters-completion 
article 
<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters-completion.html>

Correct me, If I have understood something wrongly. 

My question is, Will Elasticsearch be supporting numeric value in near 
future for completion suggester ?
Or is there any way I can use completion suggester for this purpose ?

Or suggest me some better alternative to solve this problem. 

Thanks,
Hemant


-- 
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/c3b74171-9a1e-4c32-8a4b-2d959390c61b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Getting wrong result, while using range query as query string

2014-05-14 Thread Hemant
I have Indexed some data with the following mapping 

   1. {
   2. "inventory": {
   3. "products": {
   4. "properties": {
   5. "exp_date": {
   6. "type": "date",
   7. "format": "dateOptionalTime"
   8. },
   9. "man_date": {
   10. "type": "date",
   11. "format": "dateOptionalTime"
   12. },
   13. "price": {
   14. "type": "long"
   15. },
   16. "product_description": {
   17. "type": "string"
   18. },
   19. "product_name": {
   20. "type": "string"
   21. },
   22. "quan_available": {
   23. "type": "long"
   24. }
   25. }
   26. }
   27. }
   28. }


Using [108 TO 110] as query string, results unwanted document to be 
selected in search result 



And when I add the field Name to the query string , the result is as 
expected. 
query string -> price:[108 TO 110] returns correct result as follows 


Any insight for this problem will be great. 

Thanks In Advance.

-- 
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/29129d48-7b4b-4fe1-afa2-f8746e0e6abb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problem while searching for date range or date

2014-05-02 Thread Hemant

Found the solution to same problem here -
https://groups.google.com/forum/#!searchin/elasticsearch/date/elasticsearch/eeTwWVf6Sfo/1jbHq0gca6QJ

Thanks. 


On Friday, May 2, 2014 3:13:30 PM UTC+5:30, Hemant wrote:
>
> Hello, 
>
> I have indexed some data, with default mapping -
>
>1. {
>2. "inventory": {
>3. "products": {
>4. "properties": {
>5. "exp_date": {
>6. "type": "date",
>7. "format": "dateOptionalTime"
>8. },
>9. "man_date": {
>10. "type": "date",
>11. "format": "dateOptionalTime"
>12. },
>13. "price": {
>14. "type": "long"
>15. },
>16. "product_description": {
>17. "type": "string"
>18. },
>19. "product_name": {
>20. "type": "string"
>21. },
>22. "quan_available": {
>23. "type": "long"
>24. }
>25. }
>26. }
>27. }
>28. }
>
>
> Now when I perform a search to match some date, I am not getting the 
> expected result. 
> Consider query like this
> {
>   "query": {
> "filtered": {
>   "query": {
> "query_string": {
>   "query": "exp_date:[2013-03-1 TO 2013-03-5]"
> }
>   }
> }
>   },
>   "fields": [
> "price",
> "quan_available",
> "product_name",
> "product_description",
> "exp_date",
> "man_date"
>   ],
>   "from": 0,
>   "size": 50,
>   "sort": {
> "_score": {
>   "order": "asc"
> }
>   },
>   "explain": true
> }
>
> Gives me expected result, that is all the documents which matches this 
> date range, but when I remove the field Name exp_date from the query 
> string, I am getting no result at all. 
> The following query results zero result.
> { "query": { "filtered": { "query": { "query_string": { "query": 
> "[2013-03-1 TO 2013-03-5]" } } } }, "fields": [ "price", "quan_available", 
> "product_name", "product_description", "exp_date", "man_date" ], "from": 0, 
> "size": 50, "sort": { "_score": { "order": "asc" } }, "explain": true }
>
> Can anybody suggest solution to this problem? What am doing wrong?
> Thansk in advance. 
>

-- 
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/5155a1ed-b2d2-4fa7-9f2e-c37dd3323d52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Problem while searching for date range or date

2014-05-02 Thread Hemant
Hello, 

I have indexed some data, with default mapping -

   1. {
   2. "inventory": {
   3. "products": {
   4. "properties": {
   5. "exp_date": {
   6. "type": "date",
   7. "format": "dateOptionalTime"
   8. },
   9. "man_date": {
   10. "type": "date",
   11. "format": "dateOptionalTime"
   12. },
   13. "price": {
   14. "type": "long"
   15. },
   16. "product_description": {
   17. "type": "string"
   18. },
   19. "product_name": {
   20. "type": "string"
   21. },
   22. "quan_available": {
   23. "type": "long"
   24. }
   25. }
   26. }
   27. }
   28. }


Now when I perform a search to match some date, I am not getting the 
expected result. 
Consider query like this
{
  "query": {
"filtered": {
  "query": {
"query_string": {
  "query": "exp_date:[2013-03-1 TO 2013-03-5]"
}
  }
}
  },
  "fields": [
"price",
"quan_available",
"product_name",
"product_description",
"exp_date",
"man_date"
  ],
  "from": 0,
  "size": 50,
  "sort": {
"_score": {
  "order": "asc"
}
  },
  "explain": true
}

Gives me expected result, that is all the documents which matches this date 
range, but when I remove the field Name exp_date from the query string, I 
am getting no result at all. 
The following query results zero result.
{ "query": { "filtered": { "query": { "query_string": { "query": 
"[2013-03-1 TO 2013-03-5]" } } } }, "fields": [ "price", "quan_available", 
"product_name", "product_description", "exp_date", "man_date" ], "from": 0, 
"size": 50, "sort": { "_score": { "order": "asc" } }, "explain": true }

Can anybody suggest solution to this problem? What am doing wrong?
Thansk in advance. 

-- 
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/ef046043-c666-4d11-8bf9-b46d28b421eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Improving Relevancy for Exact matches

2014-01-09 Thread hemant pahilwani
Example below might explain what is the issue i am facing:

I am trying to search Jimmy John on first name and last name fields and i 
want result to look like:

*fname  lname*
Jimmy John
JohnJimmy
John Mayer
John Yule
.
.

but i am getting following result
*fname  lname*
John Jimmy
John Mayer
John Yule
Jimmy John
.
.

I am trying to get Jimmy John to be displayed at top but not sure why John 
Jimmy is getting displayed first.  Is there a way to fine tune elastic 
search to return Jimmy John first i.e. sequence of input query phase should 
match sequence of fields passed?  

Both fname and lname use *standard* analyzer.  Below is the multi match 
query that i am using:

{
  "from" : 0,
  "size" : 300,
  "query" : {
"multi_match" : {
  "query" : "Jimmy John",
  "fields" : [ "fname", "lname" ],
  "use_dis_max" : false
}
  },
  "min_score" : 0.15,
  "explain" : true
}


-- 
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/66207eae-d15c-45e4-94cd-e8bd3a8a55f3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.