Removing entry from the _suggest

2015-03-26 Thread Nikolay Chankov
Hi,

I am experiencing problems to remove entry from elastic search.

Here is the scenario

I have venues. Each venue could have state "open" or "closed" (in Mysql). 
When the state is "open" the entry should be in the elastic search, so I 
can search for it and display it on the site.
But when it's marked as "closed" the venue should be removed from the ES 
index, so no one can search it.

The functionality for adding and removing the entry from the index is 
working seamless, and if I search for the venue name it doesn't display in 
the search results.

The problem is that I have an autocomplete where I am using _suggest and 
when I start typing the venue name e.g. "churchills" the entry is in the 
autocomplete.

When I search in the index by venue id the entry is missing and it appear 
when I "open" it again, but suggest seems that it's not affected. I am 
quite sure that I am searching in the correct index, so it's not the case, 
that I am removing it from one index, but I am looking into another.

Are there any specifics how to remove entry from the _suggest?

My instance is ES 1.1.1

Thank you in advance.

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/0d69185c-dfe1-482b-a727-93aab57c4f94%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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  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": {
>>&g

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 > 
> 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> | 
>> @elasticsearchfr<https://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 shoul

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> | 
> @elasticsearchfr<https://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 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.


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: Scoring rules : Text based search

2014-01-24 Thread Nikolay Chankov
In Lucene one of the scoring criteria is the size of the field (in your 
case the document) as shorter it is, the score is bigger, but the score 
with multiple keywords rather than single one is strange. Are you sue that 
the words are matching? Could you provide your search query?

On Friday, January 24, 2014 11:20:03 AM UTC, Hiro Gangwani wrote:
>
> Dear Team,
> We are doing indexing of document contents (Like word, PDF) in ES 0.90 
> version. Our application primarily uses text based search features from 
> document content. Our search criteria is as follows.
>
> 1. All of keywords
> 2. Any of keywords
>
> We need to give highest priority to all of key words than any of keywords 
> search criteria. In other words based upon word count documents having all 
> of the key words should be shown first (High relevancy) then any of key 
> words. For this purpose we have applied highest boost factor to All of 
> keywords field than any of key words fields. Despite applying higher boost 
> factor we get results with document having less count of words with highest 
> score. Upon analyzing we found that size of document also plays role while 
> deciding the score. e.g document 1 (137KB) has 60 matching keywords and 
> document 2 (56kb) has 49 matching words. Despite this document 2 is shown 
> first having higher score than document 1. I think size of document matters 
> while deciding the relevancy and score.
>
> Is there mechanism to assign higher score based upon count of word as 
> defined in search criteria so that same is shown as top? We are using Java 
> API to query from ES indexes.
>
> Thanks,
>
> Hiro.
>

-- 
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/c7fc5d7c-cf9b-41b9-abb8-697dc8ea1521%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 
>> scripts<http://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://loc

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 
> scripts<http://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"
>>>>> 

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

2014-01-23 Thread Nikolay Chankov
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 
scripts<http://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/6c5871a3-7421-4626-86c6-ca92afce3534%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.


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.


Order by name doesn't work as expected

2014-01-02 Thread Nikolay Chankov
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/f8fbba45-186a-42b2-86be-970ef65e60a5%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 > 
> 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> | 
>> @elasticsearchfr<https://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 .
> 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.


Re: How can I use multi_match and partial keyword

2013-12-27 Thread Nikolay Chankov
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*
> @dadoonet <https://twitter.com/dadoonet> | 
> @elasticsearchfr<https://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 elasticsearch+unsubscr...@googlegroups.com.
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.


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: What is the best way to make multy index search

2013-12-23 Thread Nikolay Chankov
Actually, I've managed to achieve something with the following query:

curl -XGET 'http://localhost:9200/venues,users,events/_search?pretty=true' 
-d '
{
"query" : {
"bool" : {
"should" : [
{
"indices" : {
"indices" : ["venues"],
"query" : {
"multi_match" : {
"query" : "*Joh*",
"fields" : ["name^4", "town^3"]
}
}
}
},
{
"indices" : {
"indices" : ["users"],
"query" : {
"multi_match" : {
"query" : "*Joh*",
"fields" : ["name^4", "town^3"]
}
}
}
},
{
"indices" : {
"indices" : ["events"],
"query" : {
"multi_match" : {
"query" : "*Joh*",
"fields" : ["name^4", "parent_name^3", 
"town^2"]
}
}
}
}
]
}
}
}'

But still I struggled to find how to make the search by part of the phrase. 
As you can see I've put *Term*, but this doesn't help me, since on a 
specific phrase (like part of some user's name, which I know it exist) it 
doesn't return the result with that user. i.e. if I search for "Chan", 
since I have a user in the system, it should appear in the list, but it 
doesn't If I complete the name "Chankov" I can see that record in the list.

Also is that the correct way of doing this type of query, or I need to try 
another one?

Thank you!

On Monday, December 23, 2013 10:32:15 PM UTC, Nikolay Chankov wrote:
>
> 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/7e1ee34b-b8ee-44f1-a818-b825999b1e4e%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.


Re: jdbc river and geospatial field

2013-12-20 Thread Nikolay Chankov
Thanks Jörg

I've managed to fix it by first problem, basically by creating the index 
before creating the river and then everything went well.

But, I tried to reproduce the same on another server, fresh install with 
the latest stable elasticsearch 0.90.8 as well as latest jdbc and mysql 
jdbc connector (my development server uses old version of ES).
So, I've managed to install the server as well as to connect it to mysql

But now the problem is that when I run The command to create the river it 
doesn't put the data into the proper index even though it was specified.

Here is the current set of commands which I am using to create the index 
and river:
curl -XDELETE localhost:9200/_river/venues_river
curl -XDELETE 'http://localhost:9200/venues'
curl -XPUT 'http://localhost:9200/venues/'
curl -XPUT 'http://localhost:9200/venues/venue/_mapping' -d '
{
"venue" : {
"properties" : {
"object" : { "type" : "string" },
"id" : { "type" : "integer" },
"name" : { "type" : "string" },
"description" : { "type" : "string" },
"town" : { "type" : "string" },
"town_id" : { "type" : "integer" },
"county" : { "type" : "string" },
"county_id" : { "type" : "integer" },

"phone" : { "type" : "string" },
"web" : { "type" : "string" },
"type" : { "type" : "string" },
"type_id" : { "type" : "integer" },
"postcode" : { "type" : "string" },

"created" : { "type" : "date" },
"modified" : { "type" : "date" },

"address" : { "type" : "string" },
"email" : { "type" : "string" },

"slug" : { "type" : "string" },
"location" : {"type" : "geo_point"}
}
}
}'
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" : {
"index" : "venues",
"type" : "venue"
}
}'

The data itself is inserted, but instead to be inserted on "venues" index, 
it is in "jdbc", so I can access it by localhost:9200/jdbc/_search...

Strangely enough, this script is working as expected on my development 
server which is:
ES: 0.90.5
JDBC: elasticsearch-river-jdbc-2.2.1.jar
Mysql JDBC mysql-connector-java-5.1.26-bin.jar

I am sorry, by asking probably stupid questions...

Thank you in advance


On Friday, December 20, 2013 8:08:02 AM UTC, Jörg Prante wrote:
>
> You must use "lat" and "lon" as field names within geo_type, not "lat" and 
> "lng".
>
> 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/36a3eec8-25a3-499a-b7b2-3a868741ac35%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: jdbc river and geospatial field

2013-12-19 Thread Nikolay Chankov
Hi Jörg,

I've reached the desired result, but it's working strangely. Here is what I 
mean.

If I run this (delete the river and the index itself and then recreate 
them):
curl -XDELETE localhost:9200/_river/venues_river
curl -XDELETE 'http://localhost:9200/venues'

curl -XPUT 'localhost:9200/_river/venues_river/_meta' -d '{
"strategy" : "simple",
"type" : "jdbc",
"jdbc" : {
...
},
"index" : {
"index" : "venues",
"type" : "venue"
},
"mappings" : {
"venue" : {
"properties" : {

"location" : {"type" : "geo_point"}
}
}
}
}'

even though the location type is set as geo_point, when I check the url: 
http://localhost:9200/venues/_mapping I can see that there is no type 
assigned to the location. It has 

{
venues: {
venue: {
properties: {
...
location: {
properties: {
lat: {type: "double"},
lng: {type: "double"}
}
},
}
}
}
}

Although if I create a new mapping like this:

curl -XPUT 'http://localhost:9200/venues/geo/_mapping' -d '
{
"venue" : {
"properties" : {
"location" : {"type" : "geo_point"}
}
}
}'

I can see that the second one the location has type "geo_point". If I 
replace /geo/ with /venue/ it return error

MergeMappingException[Merge failed with failures {[Can't merge a non object 
mapping [location] with an object mapping [location]]}]

Could that be a bug or because the location has sub nodes it doesn't set 
the type?

Thanks for the quick response! 



On Thursday, December 19, 2013 9:45:08 PM UTC, Nikolay Chankov wrote:
>
> Thanks for the hint, Jörg
>
> I will try it! 
>
> On Thursday, December 19, 2013 7:54:02 PM UTC, Jörg Prante wrote:
>>
>> My suggestion is to use two SQL columns "location.lat" and "location.lon" 
>> instead of flat "lat" and "lng". With "type": "geo_point" mapping, a geo 
>> search should be straightforward.
>>
>> 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/83168f6c-0a66-4622-9402-228deb0cd275%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: jdbc river and geospatial field

2013-12-19 Thread Nikolay Chankov
Thanks for the hint, Jörg

I will try it! 

On Thursday, December 19, 2013 7:54:02 PM UTC, Jörg Prante wrote:
>
> My suggestion is to use two SQL columns "location.lat" and "location.lon" 
> instead of flat "lat" and "lng". With "type": "geo_point" mapping, a geo 
> search should be straightforward.
>
> 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/4a554eb3-21cf-479b-87fe-b779533bafb3%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


jdbc river and geospatial field

2013-12-19 Thread Nikolay Chankov
Hi everyone,

I have the following case:

I've managed to configure jdbc river and connect MySql to ES. I've created 
an index called "venues" and it has the same structure as the mysql table 
(it's a flat object under the _source). Each node has 2 fields: lat and 
lng, which are decimal in the mysql table. 

My question is: how it's possible to make geospatial search (filter and 
sort) based on these 2 fields OR how to make a geo point based on these 2 
fields?

Your help is much appreciated!

Regards 

-- 
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/424c5a6e-c2af-45d7-8e59-b65d2564ba7d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.