Re: order of the elements does matter?

2014-01-28 Thread Nikolay Chankov
Hi David,

Here is full gist:

curl -XDELETE 'http://localhost:9200/test_search'
curl -XPUT 'http://localhost:9200/test_search/' -d '
{
mappings : {
record : {
properties : {
object : { 
type : string,
index : not_analyzed
},
name : { 
type : string
}
}
}
}
}
'
curl -XPUT 'http://localhost:9200/test_search/record/1' -d '{
object : User,
name : John Doe
}'
curl -XPUT 'http://localhost:9200/test_search/record/2' -d '{
object : User,
name : Jane Doe
}'
curl -XPUT 'http://localhost:9200/test_search/record/3' -d '{
object : User,
name : Joseph Doe
}'
curl -XPUT 'http://localhost:9200/test_search/record/4' -d '{
object : User,
name : Anna Doe
}'
curl -XPUT 'http://localhost:9200/test_search/record/5' -d '{
object : Venue,
name : Bar Luna
}'

curl -XGET 'http://localhost:9200/test_search/_search?pretty=true' -d '{
query: {
match_all: {},
filtered: {
filter: {
term: {
object: User
}
}
}
},
size : 2
}'

I've noticed that the problem exist only if under the top query node 
there are 2 elements. If I remove match_all or filtered section the 
size does take effect.
I've combined the examples in And Filter + Term Filter to create the 
query, but probably this is the wrong way?

Thanks

On Monday, January 27, 2014 7:42:15 PM UTC, David Pilato wrote:

 Yes please. If you can gist a full curl recreation, that will help a lot!

 --
 David ;-)
 Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs


 Le 27 janv. 2014 à 19:36, Nikolay Chankov ncha...@gmail.com javascript: 
 a écrit :

 I've noticed, that the problem came when in the request there is a 
 filtered node. Here is the full request:

 curl-XGET 'http://localhost/search/_search' -d'{
   query: {
 match_all: {},
 filtered: {
   filter: {
 term: {
   object: User
 }
   }
 }
   },
   size: 3,
   sort: [
 {
   name.untouched: asc
 }
   ]
 }'

 So, if it's called this way the sort and size are ignored, while if they 
 are placed above the query, they take effect, and I can see 3 records.
 if it's not correct, I would expect to get an error, rather than ignoring 
 the params...

 name is a multi_field with name.untouched is index not analyzed, object is 
 string, not analyzed. If it's still required I will try to create a full 
 gist tomorrow.


 On Monday, January 27, 2014 5:54:48 PM UTC, David Pilato wrote:

  Can you reproduce it with a full curl recreation and gist it?
 In which version?

 If confirmed, could you open an issue?

 -- 
 *David Pilato* | *Technical Advocate* | *Elasticsearch.com 
 http://Elasticsearch.com*
 @dadoonet https://twitter.com/dadoonet | 
 @elasticsearchfrhttps://twitter.com/elasticsearchfr


 Le 27 janvier 2014 at 18:50:32, Nikolay Chankov (ncha...@gmail.com) a 
 écrit:

 Hi guys, 

 today I've noticed that order of the elements in the request does matter 
 for example:

  curl -XGET 'http://localhost:9200/search/_search'-d '
 {
sort : {...},
size : 100,
query : {...}
 }'
  
 is working, while

  curl -XGET 'http://localhost:9200/search/_search'-d '
 {
query : {...},
sort : {...},
size : 100
 }'
  
 Doesn't take effect of size as well as on sort. 

 I think the order shouldn't matter, and ES should reorder the elements 
 internally. Am I get it wrong, or there is special reason for this?

 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 elasticsearc...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/elasticsearch/c0d7791a-9c8a-40e9-855d-b6a88f2f2c87%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.

  -- 
 You received this message because you are subscribed to the Google Groups 
 elasticsearch group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to elasticsearc...@googlegroups.com javascript:.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/elasticsearch/efb884a7-2e0c-4194-82b3-c4b91f5f7751%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
You received this message because you are subscribed to the Google Groups 
elasticsearch group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/3eebf7c1-8601-4e18-bfc3-68656da64e7b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: order of the elements does matter?

2014-01-28 Thread Nikolay Chankov
Thanks got clarification Zachary,

I was expected an exception too. Anyway, I need to change my query.

Thanks for your help guys!

On Tuesday, January 28, 2014 12:28:20 PM UTC, Zachary Tong wrote:

 So the root cause is that your query is structured incorrectly.  The 
 match_all should be inside of a query element, inside the filtered 
 query:

 curl -XGET http://localhost:9200/test_search/_search?pretty=true; -d'
 {
 query: {
 filtered: {
 query : {match_all: {}},
 filter: {
 term: {
 object: User
 }
 }
 }
 },
 size : 2
 }'


 Although this is technically a syntax error, it is very unfriendly of 
 Elasticsearch to not throw an exception and let you know.  There is a PR to 
 fix this problem and it'll probably be merged soon:  
 https://github.com/elasticsearch/elasticsearch/pull/4913

 In the future Elasticsearch will throw an exception instead of silently 
 eating the error and giving strange results.

 -Zach



 On Tuesday, January 28, 2014 3:48:26 AM UTC-5, Nikolay Chankov wrote:

 Hi David,

 Here is full gist:

 curl -XDELETE 'http://localhost:9200/test_search'
 curl -XPUT 'http://localhost:9200/test_search/' -d '
 {
 mappings : {
 record : {
 properties : {
 object : { 
 type : string,
 index : not_analyzed
 },
 name : { 
 type : string
 }
 }
 }
 }
 }
 '
 curl -XPUT 'http://localhost:9200/test_search/record/1' -d '{
 object : User,
 name : John Doe
 }'
 curl -XPUT 'http://localhost:9200/test_search/record/2' -d '{
 object : User,
 name : Jane Doe
 }'
 curl -XPUT 'http://localhost:9200/test_search/record/3' -d '{
 object : User,
 name : Joseph Doe
 }'
 curl -XPUT 'http://localhost:9200/test_search/record/4' -d '{
 object : User,
 name : Anna Doe
 }'
 curl -XPUT 'http://localhost:9200/test_search/record/5' -d '{
 object : Venue,
 name : Bar Luna
 }'

 curl -XGET 'http://localhost:9200/test_search/_search?pretty=true' -d '{
 query: {
 match_all: {},
 filtered: {
 filter: {
 term: {
 object: User
 }
 }
 }
 },
 size : 2
 }'

 I've noticed that the problem exist only if under the top query node 
 there are 2 elements. If I remove match_all or filtered section the 
 size does take effect.
 I've combined the examples in And Filter + Term Filter to create the 
 query, but probably this is the wrong way?

 Thanks

 On Monday, January 27, 2014 7:42:15 PM UTC, David Pilato wrote:

 Yes please. If you can gist a full curl recreation, that will help a lot!

 --
 David ;-)
 Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs


 Le 27 janv. 2014 à 19:36, Nikolay Chankov ncha...@gmail.com a écrit :

 I've noticed, that the problem came when in the request there is a 
 filtered node. Here is the full request:

 curl-XGET 'http://localhost/search/_search' -d'{
   query: {
 match_all: {},
 filtered: {
   filter: {
 term: {
   object: User
 }
   }
 }
   },
   size: 3,
   sort: [
 {
   name.untouched: asc
 }
   ]
 }'

 So, if it's called this way the sort and size are ignored, while if they 
 are placed above the query, they take effect, and I can see 3 records.
 if it's not correct, I would expect to get an error, rather than 
 ignoring the params...

 name is a multi_field with name.untouched is index not analyzed, object 
 is string, not analyzed. If it's still required I will try to create a full 
 gist tomorrow.


 On Monday, January 27, 2014 5:54:48 PM UTC, David Pilato wrote:

  Can you reproduce it with a full curl recreation and gist it?
 In which version?

 If confirmed, could you open an issue?

 -- 
 *David Pilato* | *Technical Advocate* | *Elasticsearch.com 
 http://Elasticsearch.com*
 @dadoonet https://twitter.com/dadoonet | 
 @elasticsearchfrhttps://twitter.com/elasticsearchfr


 Le 27 janvier 2014 at 18:50:32, Nikolay Chankov (ncha...@gmail.com) a 
 écrit:

 Hi guys, 

 today I've noticed that order of the elements in the request does 
 matter for example:

  curl -XGET 'http://localhost:9200/search/_search'-d '
 {
sort : {...},
size : 100,
query : {...}
 }'
  
 is working, while

  curl -XGET 'http://localhost:9200/search/_search'-d '
 {
query : {...},
sort : {...},
size : 100
 }'
  
 Doesn't take effect of size as well as on sort. 

 I think the order shouldn't matter, and ES should reorder the elements 
 internally. Am I get it wrong, or there is special reason for this?

 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

order of the elements does matter?

2014-01-27 Thread Nikolay Chankov
Hi guys,

today I've noticed that order of the elements in the request does matter 
for example:

curl -XGET 'http://localhost:9200/search/_search'-d '
{
   sort : {...},
   size : 100,
   query : {...}
}'

is working, while

curl -XGET 'http://localhost:9200/search/_search'-d '
{
   query : {...},
   sort : {...},
   size : 100
}'

Doesn't take effect of size as well as on sort. 

I think the order shouldn't matter, and ES should reorder the elements 
internally. Am I get it wrong, or there is special reason for this?

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/c0d7791a-9c8a-40e9-855d-b6a88f2f2c87%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: order of the elements does matter?

2014-01-27 Thread Nikolay Chankov
I've noticed, that the problem came when in the request there is a 
filtered node. Here is the full request:

curl-XGET 'http://localhost/search/_search' -d'{
  query: {
match_all: {},
filtered: {
  filter: {
term: {
  object: User
}
  }
}
  },
  size: 3,
  sort: [
{
  name.untouched: asc
}
  ]
}'

So, if it's called this way the sort and size are ignored, while if they 
are placed above the query, they take effect, and I can see 3 records.
if it's not correct, I would expect to get an error, rather than ignoring 
the params...

name is a multi_field with name.untouched is index not analyzed, object is 
string, not analyzed. If it's still required I will try to create a full 
gist tomorrow.


On Monday, January 27, 2014 5:54:48 PM UTC, David Pilato wrote:

  Can you reproduce it with a full curl recreation and gist it?
 In which version?

 If confirmed, could you open an issue?

 -- 
 *David Pilato* | *Technical Advocate* | *Elasticsearch.com*
 @dadoonet https://twitter.com/dadoonet | 
 @elasticsearchfrhttps://twitter.com/elasticsearchfr


 Le 27 janvier 2014 at 18:50:32, Nikolay Chankov 
 (ncha...@gmail.comjavascript:) 
 a écrit:

 Hi guys, 

 today I've noticed that order of the elements in the request does matter 
 for example:

  curl -XGET 'http://localhost:9200/search/_search'-d '
 {
sort : {...},
size : 100,
query : {...}
 }'
  
 is working, while

  curl -XGET 'http://localhost:9200/search/_search'-d '
 {
query : {...},
sort : {...},
size : 100
 }'
  
 Doesn't take effect of size as well as on sort. 

 I think the order shouldn't matter, and ES should reorder the elements 
 internally. Am I get it wrong, or there is special reason for this?

 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 elasticsearc...@googlegroups.com javascript:.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/elasticsearch/c0d7791a-9c8a-40e9-855d-b6a88f2f2c87%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.



-- 
You received this message because you are subscribed to the Google Groups 
elasticsearch group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/efb884a7-2e0c-4194-82b3-c4b91f5f7751%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Score depending on position in the term on the field

2014-01-23 Thread Nikolay Chankov
Hi Johan,

thanks for the reply

I would agree that it's ok, if I am searching for common term, like 
'venue', 'club' or 'bar', but when it comes to User names, it make sense to 
score the position in the field too, because when you search in field 
user.name, and type 'Jo' you would expect first to see users with first 
name Joe, Johan, John, rather than having users with Jo in the family.

And especially when you search for user name field you don't expect to have 
more occurrence of the name  in that field.



On Wednesday, January 22, 2014 9:30:19 PM UTC, Johan Rask wrote:

 Lucene will calculate you score based on a scoring formula. I am pretty 
 sure that the location of the word is not part of this formula but rather 
 how common the
 word is in your sentence. I.e multiple occurences of 'venue' should 
 increase scoring and adding other words to your sentence should decrease 
 the scoring.

 Hope this helps, I am pretty sure there is detailed info about this in the 
 lucene docs. 

 Kind regards /Johan

 Den onsdagen den 22:e januari 2014 kl. 13:10:00 UTC+1 skrev Nikolay 
 Chankov:

 I am playing with elasticsearch so far, and i noticed something:

 If I search for a word in a string, the _score is equal no matter where 
 is placed the word. Here I have prepared a test case:

 curl -XDELETE 'http://localhost:9200/test_search'
 curl -XPUT 'http://localhost:9200/test_search/' -d '
 {
 mappings : {
 test_record : {
 properties : {
 name : { 
 type : string
 }
 }
 }
 }
 }'

 curl -XPUT 'http://localhost:9200/test_search/test_record/1' -d '{
 name : is the name Venue of that one
 }'

 curl -XPUT 'http://localhost:9200/test_search/test_record/2' -d '{
 name : is the name of that one Venue
 }'

 curl -XPUT 'http://localhost:9200/test_search/test_record/3' -d '{
 name : Venue is the name of that one
 }'

 curl -XGET 'http://localhost:9200/test_search/_search' -d '{
 query: {
 bool: {
 must: [ ],
 must_not: [ ],
 should: [
 {
 query_string : {
 default_field: _all,
 query : venue
 }
 }
 ]
 }
 },
 from: 0,
 size: 10
 }'

 The question is: how to have different score based on the position of the 
 word 'venue' in the test. When I search I would expect results to be 
 ordered 3,1,2 while now they are as they are inserted ,1,2,3.

 Any hint will be much appreciated



-- 
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/d2d79908-0131-4220-941c-eb31e51b9667%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Score depending on position in the term on the field

2014-01-23 Thread Nikolay Chankov
Just checked the Facebook suggestion style and I would imagine something 
like, this, When you start typing terms which start with the phrase/word 
are in the top, while the terms which just contain the phrase/word, are at 
the bottom. But I could be wrong that that the order is this way :)


On Thursday, January 23, 2014 10:08:25 AM UTC, Nikolay Chankov wrote:

 Hi Johan,

 I've already saw this suggestion, but it's not really useful for me, since 
 in the index there are various document with different types. For example, 
 I have users, but also I have venues and events, last two had only name, 
 while user could have two names.

 In general I am trying to build an autosuggest feature on a site and when 
 you start typing 'Joh' the suggestions will be first users starting with 
 'Joh', but there could be some venues starting with 'Joh' string as well, 
 so as much you type, the more concrete results you will have, but I am also 
 reading about suggesters, and probably I will implement a solution which 
 will be more like Google autosuggest rather displaying the first few 
 results of the search itself.

 I've seen also text scoring in 
 scriptshttp://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-advanced-scripting.html
  which 
 could be a solution as well.

 I just wanted to ask if there is something like common way of score the 
 position of the term in a field, but obviously there is no such way. :)

 Thanks for the help



 On Thursday, January 23, 2014 9:36:47 AM UTC, Johan Rask wrote:

 Hi again,

 Can you explain more what you are trying to accomplish?

 I think that the only way you can solve this is to split into multiple 
 fields and
 then boost individual fields in your query. Not sure if thats possible 
 for you.

 /Johan

 Den torsdagen den 23:e januari 2014 kl. 09:44:02 UTC+1 skrev Nikolay 
 Chankov:

 Hi Johan,

 thanks for the reply

 I would agree that it's ok, if I am searching for common term, like 
 'venue', 'club' or 'bar', but when it comes to User names, it make sense to 
 score the position in the field too, because when you search in field 
 user.name, and type 'Jo' you would expect first to see users with first 
 name Joe, Johan, John, rather than having users with Jo in the family.

 And especially when you search for user name field you don't expect to 
 have more occurrence of the name  in that field.



 On Wednesday, January 22, 2014 9:30:19 PM UTC, Johan Rask wrote:

 Lucene will calculate you score based on a scoring formula. I am pretty 
 sure that the location of the word is not part of this formula but rather 
 how common the
 word is in your sentence. I.e multiple occurences of 'venue' should 
 increase scoring and adding other words to your sentence should decrease 
 the scoring.

 Hope this helps, I am pretty sure there is detailed info about this in 
 the lucene docs. 

 Kind regards /Johan

 Den onsdagen den 22:e januari 2014 kl. 13:10:00 UTC+1 skrev Nikolay 
 Chankov:

 I am playing with elasticsearch so far, and i noticed something:

 If I search for a word in a string, the _score is equal no matter 
 where is placed the word. Here I have prepared a test case:

 curl -XDELETE 'http://localhost:9200/test_search'
 curl -XPUT 'http://localhost:9200/test_search/' -d '
 {
 mappings : {
 test_record : {
 properties : {
 name : { 
 type : string
 }
 }
 }
 }
 }'

 curl -XPUT 'http://localhost:9200/test_search/test_record/1' -d '{
 name : is the name Venue of that one
 }'

 curl -XPUT 'http://localhost:9200/test_search/test_record/2' -d '{
 name : is the name of that one Venue
 }'

 curl -XPUT 'http://localhost:9200/test_search/test_record/3' -d '{
 name : Venue is the name of that one
 }'

 curl -XGET 'http://localhost:9200/test_search/_search' -d '{
 query: {
 bool: {
 must: [ ],
 must_not: [ ],
 should: [
 {
 query_string : {
 default_field: _all,
 query : venue
 }
 }
 ]
 }
 },
 from: 0,
 size: 10
 }'

 The question is: how to have different score based on the position of 
 the word 'venue' in the test. When I search I would expect results to be 
 ordered 3,1,2 while now they are as they are inserted ,1,2,3.

 Any hint will be much appreciated



-- 
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/2f1ea0ed-a0f8-4b38-b483-3b223d4a2899%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Score depending on position in the term on the field

2014-01-23 Thread Nikolay Chankov
Well, it's really strange, that position is not encountered, since with 
many results and especially data with lot of similarities (user names) 
doesn't get sorted also by string position somehow.

Anyone to share how do they make autocomplete? Feeling really stupid :(

On Thursday, January 23, 2014 10:56:30 AM UTC, Nikolay Chankov wrote:

 Just checked the Facebook suggestion style and I would imagine something 
 like, this, When you start typing terms which start with the phrase/word 
 are in the top, while the terms which just contain the phrase/word, are at 
 the bottom. But I could be wrong that that the order is this way :)


 On Thursday, January 23, 2014 10:08:25 AM UTC, Nikolay Chankov wrote:

 Hi Johan,

 I've already saw this suggestion, but it's not really useful for me, 
 since in the index there are various document with different types. For 
 example, I have users, but also I have venues and events, last two had only 
 name, while user could have two names.

 In general I am trying to build an autosuggest feature on a site and when 
 you start typing 'Joh' the suggestions will be first users starting with 
 'Joh', but there could be some venues starting with 'Joh' string as well, 
 so as much you type, the more concrete results you will have, but I am also 
 reading about suggesters, and probably I will implement a solution which 
 will be more like Google autosuggest rather displaying the first few 
 results of the search itself.

 I've seen also text scoring in 
 scriptshttp://www.elasticsearch.org/guide/en/elasticsearch/reference/master/modules-advanced-scripting.html
  which 
 could be a solution as well.

 I just wanted to ask if there is something like common way of score the 
 position of the term in a field, but obviously there is no such way. :)

 Thanks for the help



 On Thursday, January 23, 2014 9:36:47 AM UTC, Johan Rask wrote:

 Hi again,

 Can you explain more what you are trying to accomplish?

 I think that the only way you can solve this is to split into multiple 
 fields and
 then boost individual fields in your query. Not sure if thats possible 
 for you.

 /Johan

 Den torsdagen den 23:e januari 2014 kl. 09:44:02 UTC+1 skrev Nikolay 
 Chankov:

 Hi Johan,

 thanks for the reply

 I would agree that it's ok, if I am searching for common term, like 
 'venue', 'club' or 'bar', but when it comes to User names, it make sense 
 to 
 score the position in the field too, because when you search in field 
 user.name, and type 'Jo' you would expect first to see users with 
 first name Joe, Johan, John, rather than having users with Jo in the 
 family.

 And especially when you search for user name field you don't expect to 
 have more occurrence of the name  in that field.



 On Wednesday, January 22, 2014 9:30:19 PM UTC, Johan Rask wrote:

 Lucene will calculate you score based on a scoring formula. I am 
 pretty sure that the location of the word is not part of this formula but 
 rather how common the
 word is in your sentence. I.e multiple occurences of 'venue' should 
 increase scoring and adding other words to your sentence should decrease 
 the scoring.

 Hope this helps, I am pretty sure there is detailed info about this in 
 the lucene docs. 

 Kind regards /Johan

 Den onsdagen den 22:e januari 2014 kl. 13:10:00 UTC+1 skrev Nikolay 
 Chankov:

 I am playing with elasticsearch so far, and i noticed something:

 If I search for a word in a string, the _score is equal no matter 
 where is placed the word. Here I have prepared a test case:

 curl -XDELETE 'http://localhost:9200/test_search'
 curl -XPUT 'http://localhost:9200/test_search/' -d '
 {
 mappings : {
 test_record : {
 properties : {
 name : { 
 type : string
 }
 }
 }
 }
 }'

 curl -XPUT 'http://localhost:9200/test_search/test_record/1' -d '{
 name : is the name Venue of that one
 }'

 curl -XPUT 'http://localhost:9200/test_search/test_record/2' -d '{
 name : is the name of that one Venue
 }'

 curl -XPUT 'http://localhost:9200/test_search/test_record/3' -d '{
 name : Venue is the name of that one
 }'

 curl -XGET 'http://localhost:9200/test_search/_search' -d '{
 query: {
 bool: {
 must: [ ],
 must_not: [ ],
 should: [
 {
 query_string : {
 default_field: _all,
 query : venue
 }
 }
 ]
 }
 },
 from: 0,
 size: 10
 }'

 The question is: how to have different score based on the position of 
 the word 'venue' in the test. When I search I would expect results to be 
 ordered 3,1,2 while now they are as they are inserted ,1,2,3.

 Any hint will be much appreciated



-- 
You received this message because you are subscribed to the Google Groups 
elasticsearch group.
To unsubscribe from this group and stop

Score depending on position in the term on the field

2014-01-22 Thread Nikolay Chankov
I am playing with elasticsearch so far, and i noticed something:

If I search for a word in a string, the _score is equal no matter where is 
placed the word. Here I have prepared a test case:

curl -XDELETE 'http://localhost:9200/test_search'
curl -XPUT 'http://localhost:9200/test_search/' -d '
{
mappings : {
test_record : {
properties : {
name : { 
type : string
}
}
}
}
}'

curl -XPUT 'http://localhost:9200/test_search/test_record/1' -d '{
name : is the name Venue of that one
}'

curl -XPUT 'http://localhost:9200/test_search/test_record/2' -d '{
name : is the name of that one Venue
}'

curl -XPUT 'http://localhost:9200/test_search/test_record/3' -d '{
name : Venue is the name of that one
}'

curl -XGET 'http://localhost:9200/test_search/_search' -d '{
query: {
bool: {
must: [ ],
must_not: [ ],
should: [
{
query_string : {
default_field: _all,
query : venue
}
}
]
}
},
from: 0,
size: 10
}'

The question is: how to have different score based on the position of the 
word 'venue' in the test. When I search I would expect results to be 
ordered 3,1,2 while now they are as they are inserted ,1,2,3.

Any hint will be much appreciated

-- 
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/c69d8a86-f991-4f00-a315-ff56fc075bee%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Order by name doesn't work as expected

2014-01-02 Thread Nikolay Chankov
Thank you, it's working.



On Thursday, January 2, 2014 4:20:17 PM UTC, Nikolay Chankov wrote:

 Hi guys,

 for some reason, the order by name, _score is not working as I would 
 expect.
 I've prepared a simple example to explain what I mean.
 There are 2 records: john doe and jane doe. if there is no email in the 
 index their score is the same, and the order is correct, jane goes before 
 john, but if john's record has email which contain doe (the search phrase), 
 john _score is higher and the order is wrong.
 I've noticed that in the results the sort node is [ doe, 0.6328839 
 ], [ doe, 0.48819983 ] rather than [ john doe, 0.6328839 ], [ jane 
 doe, 0.48819983 ]. if the order is name:desc the search is  [ jane, 
 0.6328839 ], [ john, 0.48819983 ]

 This happen when I use query:{...}. If the query is missing the results 
 get the same weight and it is working as expected.

 do I need to make special sort somehow in order to get the desired order, 
 or it's a bug?

 Thanks in advance.

 Here is the script how to see this behavior. I am using 0.90.5 if it does 
 matter (tested 0.90.8 with the same effect). BTW, if the name is without a 
 space e.g. johndoe, janedoe the order is correct.

 curl -XDELETE 'http://localhost:9200/test_search'
 curl -XPUT 'http://localhost:9200/test_search/' -d '
 {
 mappings : {
 record : {
 properties : {
 object : { 
 type : string 
 },
 id : { 
 type : integer 
 },
 name : { 
 type : string, 
 boost : 6 
 },
 email : { 
 type : string, 
 boost : 5 
 }
 }
 }
 }

 }
 '
 curl -XPUT 'http://localhost:9200/test_search/record/1' -d '{
 object : User,
 id : 1,
 name : john doe,
 email : d...@doe.com
 }'
 curl -XPUT 'http://localhost:9200/test_search/record/2' -d '{
 object : User,
 id : 2,
 name : jane doe,
 email : j...@d.com
 }'

 curl -XGET 'http://localhost:9200/test_search/_search?pretty=true' -d 
 '{query:{filtered:{query:{queryString:{query:doe,sort:[{name:asc},_score]}'



-- 
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/ae51e048-42d0-4ad6-a5f3-710063521959%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


How can I use multi_match and partial keyword

2013-12-27 Thread Nikolay Chankov
I refined my query to the following:

curl -XGET 
'http://localhost:9200/venues,events,offers,users/_search?pretty=true' -d '
{
query : {

indices : {
indices : [venues, events, users, offers],
query : {
multi_match : {
query : Evo*,
fields : [name^4, first_name^4, 
last_name^4, town^3.5, _all^0.5]
}
}
}

}
}'

The problem now is that the * in the query doesn't take effect. i.e. If I 
use Evo* a node which has  name=Evoke doesn't show in the results, 
while if I search for Evoke it show the desired result.

So the question is: How to search for partial term within the field.

Thank you 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/a73bba3e-d91b-4da9-a373-033d6f220f1e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: How can I use multi_match and partial keyword

2013-12-27 Thread Nikolay Chankov
The indexes are populated from jdbc river, so I will try to create an 
example. The behavior is the same. HTH

Here it is:
curl -XDELETE 'http://localhost:9200/test_venues'
curl -XPUT 'http://localhost:9200/test_venues'
curl -XPUT 'http://localhost:9200/test_venues/test_venue/_mapping' -d '
{
test_venue : {
properties : {
object : { type : string },
id : { type : integer },
name : { type : string }
}
}
}'
curl -XPUT 'http://localhost:9200/test_venues/test_venue/1' -d '{
object : Venue,
id : 1,
name : Evoke
}'
curl -XPUT 'http://localhost:9200/test_venues/test_venue/2' -d '{
object : Venue,
id : 1,
name : Evo
}'

curl -XGET 'http://localhost:9200/test_venues/_search?pretty=true' -d '
{
query : {
indices : {
indices : [test_venues],
query : {
multi_match : {
query : evo*,
fields : [name^4, _all^1]
}
}
}
}
}'



On Friday, December 27, 2013 5:21:13 PM UTC, David Pilato wrote:

 Could you gist a full curl recreation?

 --
 David ;-)
 Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

 Le 27 déc. 2013 à 17:37, Nikolay Chankov ncha...@gmail.com javascript: 
 a écrit :

 Thank you for the reply David, but unfortunately it doesn't make any 
 difference. :(


 On Friday, December 27, 2013 4:11:18 PM UTC, David Pilato wrote:

 Try with evo* (lowercase).


 -- 
 *David Pilato* | *Technical Advocate* | *Elasticsearch.com 
 http://Elasticsearch.com*
 @dadoonet https://twitter.com/dadoonet | 
 @elasticsearchfrhttps://twitter.com/elasticsearchfr


 Le 27 décembre 2013 at 15:10:50, Nikolay Chankov (ncha...@gmail.com) a 
 écrit:

 I refined my query to the following: 

   curl -XGET '
 http://localhost:9200/venues,events,offers,users/_search?pretty=true' -d 
 '
 {
 query : {
 
 indices : {
 indices : [venues, events, users, 
 offers],
 query : {
 multi_match : {
 query : Evo*,
 fields : [name^4, first_name^4, 
 last_name^4, town^3.5, _all^0.5]
 }
 }
 }
 
 }
 }'
  
 The problem now is that the * in the query doesn't take effect. i.e. If I 
 use Evo* a node which has  name=Evoke doesn't show in the results, 
 while if I search for Evoke it show the desired result.

 So the question is: How to search for partial term within the field.

 Thank you 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 elasticsearc...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/elasticsearch/a73bba3e-d91b-4da9-a373-033d6f220f1e%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.

  -- 
 You received this message because you are subscribed to the Google Groups 
 elasticsearch group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to elasticsearc...@googlegroups.com javascript:.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/elasticsearch/b8c7c099-e7b5-412d-89f5-9bf2680bbf50%40googlegroups.com
 .
 For more options, visit https://groups.google.com/groups/opt_out.



-- 
You received this message because you are subscribed to the Google Groups 
elasticsearch group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/cd8c5f63-9b28-4f58-9eba-579c3ef27173%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


What is the best way to make multy index search

2013-12-23 Thread Nikolay Chankov
Hi guys,

I guess, this is pretty trivial question, but so far I couldn't find the 
answer.

The case: I have 4+ indices which contain different type of data (properly 
mapped of this make sense). I need to execute a search across all indices 
for a term, but when I search I need to put some weight over some of the 
fields such as name should have higher weight than address or 
description.

Here is a concrete example:
Index: venues which has name (weight 4), address (weight 3) all other 
fields (weight 2)
Index: users which has name (weight 4), address (weight 3) all other fields 
(weight 2)
Index: event (which belongs to venue) which has name (weight 4), venue_name 
(weight 3), address (weight 2) all other fields (weight 1)

So, I need to search for term or phrase like John which should search 
within these indices and sort the results by the score. (there could be 
user with First name John, bar Long John or event johns' bar event, 
address containing John or even description which is in all other fields.

To do so, I've read that I should use bool query together with multi match, 
but there is also DIS max query and I don't know how to specify the index. 
Here is what I am thinking to do so far:

curl -XGET 'http://localhost:9200/_search?pretty=true' -d '
{
query : {
should : [
{
multi_match : {
query : John,
fields : [name^4, address^3],
//somehow I need to specify that this is for index 
venues
}
},
{
multi_match : {
query : John,
fields : [name^4, address^3],
//somehow I need to specify that this is for index users
}  
},
{
multi_match : {
query : John,
fields : [name^4, parent_name^3, address^2],
//somehow I need to specify that this is for index 
events
}  
}
]
}
}'

Again sorry for the trivial question.

Best regards and Merry Christmas!

Nik

-- 
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/9a2645dd-def2-41f6-80a8-ecda1946e998%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: jdbc river and geospatial field

2013-12-20 Thread Nikolay Chankov
Thank you for the support! I will try it monday.

On Friday, December 20, 2013 9:32:52 PM UTC, Jörg Prante wrote:

 I have changed in the latest JDBC river the configuration format. There is 
 no index subsection anymore, just the jdbc subsection:

 curl -XPUT 'localhost:9200/_river/venues_river/_meta' -d '{
 strategy : simple,
 type : jdbc,
 jdbc : {
 driver : com.mysql.jdbc.Driver,
 url : jdbc:mysql://localhost:3306/database,
 user : user,
 password : pass,
 sql : select * from search_venues,
 index : venues,
 type : venue
 }
 }'

 Jörg



-- 
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/ff5bb92b-8f1b-4d6d-821d-b5a26213334b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.