Geo cells intersection

2015-03-06 Thread @mromagnoli
Hi, everyone,
I'm facing with an issue about geo locations and I want to know if it is 
possible to achieve it in ElasticSearch 0.9+.

I want to define in my documents, a field where I can set latitude and 
longitude and a radius, defining a circle shape, for example, and with this 
data get the shape area. Then, I want to do a geo_shape filtered search 
operation where the area set in the document will be taken in account and 
not only the actual point.

Basically, it is like a cell search matching another cells areas.

Here it's a simple graph representing this situations, hope it is clear:



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/dab81873-eea9-4546-a0cd-881a5c687667%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Filters: odd behavior

2014-10-21 Thread @mromagnoli
Thanks for answer, Ivan.

You were right, I wrapped all my filters inside bool filters and it seems 
everything is working correctly!

Thanks for your time!

Marce



El sábado, 18 de octubre de 2014 15:36:39 UTC-3, Ivan Brusic escribió:
>
> The structure of your query is odd. Either it is some format that I am not 
> aware of or the Elasticsearch parser is not doing a good job at determining 
> it is invalid.
>
> Your two filters should be joined via a bool filter. Sometime like (not 
> tested):
>
> {
>   "query": {
> "filtered": {
>   "query": {
> 
>   },
>   "filter": {
> "bool": {
>   "must": [
> {
>   "geo_distance": {
> "distance": "30km",
> "Location.location": {
>   "lat": "-32.890183",
>   "lon": "-68.844050"
> }
>   }
> },
> {
>   "not": {
> "filter": {
>   "query": {
> "terms": {
>   "_all": [
> "sex",
> "xxx",
> "sexshop"
>   ]
> }
>   }
> }
>   }
> }
>   ]
> }
>   }
> }
>   }
> }
>
> -- 
> Ivan
>
> On Sat, Oct 18, 2014 at 7:04 AM, @mromagnoli  > wrote:
>
>> Thanks guys for your responses.
>>
>> My question was due an strange behavior when using 'not' and 
>> 'geo_distance' filters.
>>
>> I want to filter some results that have undesirable words, such as 'sex', 
>> 'xxx', etc... And then geo filter those good results, but if I place 'not' 
>> filter first, then when geo filter is applied, it retrieves results with 
>> that not wanted words in it. If I place geo filter first, and then 'not' 
>> filter, geo filter seems not to be executed or something, because results 
>> are not accurate for that filter, instead, they still being good results 
>> with no bad words.
>>
>> I am using it like this:
>>
>>
>> {
>> "query": {
>> "filtered": {
>> "query": {...},
>> "filter": [
>> [{
>> "geo_distance": {
>> "distance": "30km",
>> "Location.location": {
>> "lat": "-32.890183",
>> "lon": "-68.844050"
>> }
>> }
>> }],
>> [{
>> "not": {
>> "filter": {
>>     "query": {
>> "terms": {
>> "_all": ["sex", "xxx", "sexshop"]
>> }
>> }
>> }
>> }
>> }]
>> ]
>> }
>> },
>> "from": 0,
>> "size": "10",
>> "sort": {
>> "_geo_distance": {
>> "Location.location": {
>> "lat": "-32.890183",
>> "lon": "-68.844050",
>> "order": "desc"
>> }
>> },
>> "_score": "desc"
>> }
>> }
>>
>>
>> It seems like the last filter is executed correctly.
>>
>> Thanks,
>>
>> Marce
>>
>>
>> El jueves, 16 de octubre de 2014 09:16:43 UTC-3, @mromagnoli escribió:
>>>
>>> Hi everyone, 
>>> I have a doubt about Filters. 
>>>
>>> If I have more than one filter, in a filtered query, are they executed 
>>> in the defined order? And, are they filtering in a 'chain' mode, i.e. using 
>>> the results of the previous filters?
>>>
>>> Thanks in advance as always.
>>>
>>  -- 
>> 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/4ed1e0ad-9654-40a6-a48a-b753c102d0ae%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/elasticsearch/4ed1e0ad-9654-40a6-a48a-b753c102d0ae%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/6499b6c2-379a-400d-bf8d-9087ea2aaa10%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Filters: odd behavior

2014-10-18 Thread @mromagnoli
Thanks guys for your responses.

My question was due an strange behavior when using 'not' and 'geo_distance' 
filters.

I want to filter some results that have undesirable words, such as 'sex', 
'xxx', etc... And then geo filter those good results, but if I place 'not' 
filter first, then when geo filter is applied, it retrieves results with 
that not wanted words in it. If I place geo filter first, and then 'not' 
filter, geo filter seems not to be executed or something, because results 
are not accurate for that filter, instead, they still being good results 
with no bad words.

I am using it like this:


{
"query": {
"filtered": {
"query": {...},
"filter": [
[{
"geo_distance": {
"distance": "30km",
"Location.location": {
"lat": "-32.890183",
"lon": "-68.844050"
}
}
}],
[{
"not": {
"filter": {
"query": {
"terms": {
"_all": ["sex", "xxx", "sexshop"]
}
}
}
}
}]
]
}
},
"from": 0,
"size": "10",
"sort": {
"_geo_distance": {
"Location.location": {
"lat": "-32.890183",
"lon": "-68.844050",
"order": "desc"
}
},
"_score": "desc"
}
}


It seems like the last filter is executed correctly.

Thanks,

Marce


El jueves, 16 de octubre de 2014 09:16:43 UTC-3, @mromagnoli escribió:
>
> Hi everyone, 
> I have a doubt about Filters. 
>
> If I have more than one filter, in a filtered query, are they executed in 
> the defined order? And, are they filtering in a 'chain' mode, i.e. using 
> the results of the previous filters?
>
> Thanks in advance as always.
>

-- 
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/4ed1e0ad-9654-40a6-a48a-b753c102d0ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Filters: odd behavior

2014-10-16 Thread @mromagnoli
Hi everyone, 
I have a doubt about Filters. 

If I have more than one filter, in a filtered query, are they executed in 
the defined order? And, are they filtering in a 'chain' mode, i.e. using 
the results of the previous filters?

Thanks in advance as always.

-- 
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/d528067f-5042-4667-bcbc-38dcde87010a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Removing docs from search results

2014-09-29 Thread @mromagnoli
Jörg, worked perfectly with my problem!!!

Thank you very much for your response and your time.

Marcelo

On Monday, September 29, 2014 3:33:49 PM UTC-3, Jörg Prante wrote:
>
> You have to use a technique known as anti-phrasing. "not" filters work 
> well.
>
> In your case of a "shop" query, something like
>
> {
> "query" : {
> "filtered" : {
> "query" : {
> "simple_query_string" : {
>   "query" : "shop",
>   "default_operator": "and"
> }
> },
> "filter" : {
> "not" : {
> "_cache": true,
> "filter" : {
> "query": {
> "match" : {
> "_all" : "sex"
> }
> }
> }
> }
> }
> }
> }
> }
>
> Other example with query_string:
>
> https://gist.github.com/jprante/6816555
>
> Jörg
>
>
>
> On Mon, Sep 29, 2014 at 8:04 PM, @mromagnoli  > wrote:
>
>> Hi everyone,
>>
>> I am having the next issue: I want to remove some docs from the results 
>> based in conditions. I think this is the behavior that 'filters' have. The 
>> problem is that couldn't get with the correct solution.
>>
>> Example:
>>
>> If I have an index with shops like :
>>
>> {
>>  "Shop": {
>>"name": 'Bakery My Bread'
>>  }
>> },
>> {
>>  "Shop": {
>>"name": 'Butcher Jason'
>>  }
>> },
>> {
>>  "Shop": {
>>"name": 'Sex Shop Toys'
>>  }
>> },
>> {
>>  "Shop": {
>>"name": 'Video Shop DVD'
>>  }
>> },
>>
>> What I did was to add  'sex' to the stopwords file so if someone search 
>> that word, it is discarded. This works fine at search time for that word 
>> because since it is a single token, none results are retrieved. The problem 
>> occurs when someone search something like 'shop', and, in this case, 2 
>> results are retrieved, and one of them is 'Sex Shop Toys', something I 
>> don't want to retrieve.
>>
>> Should I use some filter specifically? I tried with bool filter, regexp 
>> and not filter but those undesirable results still being brought.
>>
>> 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/3218ec76-7082-4cd1-a44b-11b450f86669%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/elasticsearch/3218ec76-7082-4cd1-a44b-11b450f86669%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/915a89b2-968a-45a2-939b-d59375f9243d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Removing docs from search results

2014-09-29 Thread @mromagnoli
Hi everyone,

I am having the next issue: I want to remove some docs from the results 
based in conditions. I think this is the behavior that 'filters' have. The 
problem is that couldn't get with the correct solution.

Example:

If I have an index with shops like :

{
 "Shop": {
   "name": 'Bakery My Bread'
 }
},
{
 "Shop": {
   "name": 'Butcher Jason'
 }
},
{
 "Shop": {
   "name": 'Sex Shop Toys'
 }
},
{
 "Shop": {
   "name": 'Video Shop DVD'
 }
},

What I did was to add  'sex' to the stopwords file so if someone search 
that word, it is discarded. This works fine at search time for that word 
because since it is a single token, none results are retrieved. The problem 
occurs when someone search something like 'shop', and, in this case, 2 
results are retrieved, and one of them is 'Sex Shop Toys', something I 
don't want to retrieve.

Should I use some filter specifically? I tried with bool filter, regexp and 
not filter but those undesirable results still being brought.

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/3218ec76-7082-4cd1-a44b-11b450f86669%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Debugging scripts

2014-05-16 Thread @mromagnoli
Someone should can answer this issue, I'm having the same problem logging 
scripts. Maybe Imovot can.


El viernes, 16 de mayo de 2014 10:33:12 UTC-3, Mike Snare escribió:
>
> I'm trying to debug an MVEL script that's failing in production but 
> working locally, and I've tried to do logging a couple different ways, but 
> I can only get logging to work locally.
>
> Both local and production are running 1.1.1, same exact build.  Both are 
> running with java 1.7._55.
>
> I've tried the logger approach based on 
> https://github.com/imotov/elasticsearch-test-scripts/blob/master/logging_from_script.sh,
>  
> but that only works when the server is running under java 1.6.  Under 1.7, 
> both local and production fail.
>
> I've tried using System.out.println, but that only works locally even 
> under java 1.7.  In production I just get "error": 
> "ElasticsearchIllegalArgumentException[failed to execute script]; nested: 
> PropertyAccessException[[Error: unresolvable property or identifier: 
> ]\n[Near : {... System.out.println(\"SCRIPT: }]\n ^\n[Line: 12, Column: 
> 1]]; "
>
> Does anyone have any pointers as to how to debug MVEL or get log output 
> from MVEL scripts in ES?
>

-- 
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/d8bc37f2-b3ea-4711-8bcd-eb65af9b61f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sense on github abandoned?

2014-04-30 Thread @mromagnoli
Yeah, maybe you are right. Anyway i have installed Marvel, and make a 
bookmark in Chrome with the URL to Sense.

Perhaps I cried in advance ;P

El miércoles, 30 de abril de 2014 17:19:36 UTC-3, Ivan Brusic escribió:
>
> Must is a strong word. I highlighted some alternatives earlier.
> On Apr 30, 2014 1:01 PM, "@mromagnoli" > 
> wrote:
>
>> Agree 100%. Sense must return to Chrome Store! 
>>
>> El martes, 29 de abril de 2014 11:52:49 UTC-3, Joshua Worden escribió:
>>>
>>> Would love to see this return to the chrome store. Was rather surprised 
>>> to see it gone when getting another developer started working with 
>>> elasticsearch. Even if it was buggy, it was the best way to get started.
>>>
>>  -- 
>> 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/98d89444-f75c-4f50-aece-6e55337c868d%40googlegroups.com<https://groups.google.com/d/msgid/elasticsearch/98d89444-f75c-4f50-aece-6e55337c868d%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/fd0ec98d-d507-4a01-a9e7-d59535637465%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Sense on github abandoned?

2014-04-30 Thread @mromagnoli
Agree 100%. Sense must return to Chrome Store! 

El martes, 29 de abril de 2014 11:52:49 UTC-3, Joshua Worden escribió:
>
> Would love to see this return to the chrome store. Was rather surprised to 
> see it gone when getting another developer started working with 
> elasticsearch. Even if it was buggy, it was the best way to get started.
>

-- 
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/98d89444-f75c-4f50-aece-6e55337c868d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Results based on conditions from results themselves (yeah I know...)

2014-04-04 Thread @mromagnoli
[SOLUTION]

As Binh suggest, I use script filter and was awesome, the query was:

{
  "query" : {
  "filtered": {
 "query" : {
...
 }
 "filter": {
   "script": {
 "script": "doc['User.id'].value != 
doc['Listing.user_id'].value"
   }
 }
  }
   }
}




El jueves, 3 de abril de 2014 16:52:29 UTC-3, @mromagnoli escribió:
>
> Hi everybody, 
> I'm having the next issue:
>
> I was wondering if via scripting or another way, I could be able to 
> discard documents retrieved based in results from the documents themselves 
> (what!?).
>
> I'll explain myself better:
>
> Suppose I have a document indexed like: 
>
>   {
>"Review": {
>   "body": "",
>   "listing_id": 352755,
>   "user_id": 4670,
>   "title": "Bla",
>   "message": "Blablabla bad service. ",
>   "id": 263
>},
>"User": {
>   "id": 4670,
>   "first_name": "",
>   "email": "exam...@example.com",
>   "username": "example",
>   "password": "123456"
>},
>"Listing": {
>   "id": 352755,
>   "user_id": 4670,
>   "website_url": "",
>   "zip_code": "3500",
>       "description": "Bla bla many things"
>}
> }
>
>
> Where I index *Reviews *from *Users* made in *Listings, *but I don't want 
> to retrieve those documents where field *User.id == Listing.user_id. *But 
> I don't know how to determine this condition when I want to dismiss a 
> document based in a condition that lives inside it.
> Is there any way to cover this limitation?
>
> Hope I was clear.
>
> Thanks in advance!
>
> Chelo (@mromagnoli)
>

-- 
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/f064a3c1-d426-4873-b8ba-4cf9ac198a89%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Results based on conditions from results themselves (yeah I know...)

2014-04-04 Thread @mromagnoli
I'm going to take a better look and see what happends.

Thx!!

El jueves, 3 de abril de 2014 18:37:25 UTC-3, Binh Ly escribió:
>
> Yes script filter can accomplish this but it could be very slow if you 
> have lots documents. You can access the source in script using the _source 
> reference.
>
>
> http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-script-filter.html#query-dsl-script-filter
>

-- 
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/bd6fbc60-72aa-4b0c-a9a2-cf4172187eba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Results based on conditions from results themselves (yeah I know...)

2014-04-03 Thread @mromagnoli
Hi everybody, 
I'm having the next issue:

I was wondering if via scripting or another way, I could be able to discard 
documents retrieved based in results from the documents themselves (what!?).

I'll explain myself better:

Suppose I have a document indexed like: 

  {
   "Review": {
  "body": "",
  "listing_id": 352755,
  "user_id": 4670,
  "title": "Bla",
  "message": "Blablabla bad service. ",
  "id": 263
   },
   "User": {
  "id": 4670,
  "first_name": "",
  "email": "exam...@example.com",
  "username": "example",
  "password": "123456"
   },
   "Listing": {
  "id": 352755,
  "user_id": 4670,
  "website_url": "",
  "zip_code": "3500",
  "description": "Bla bla many things"
   }
}


Where I index *Reviews *from *Users* made in *Listings, *but I don't want 
to retrieve those documents where field *User.id == Listing.user_id. *But I 
don't know how to determine this condition when I want to dismiss a 
document based in a condition that lives inside it.
Is there any way to cover this limitation?

Hope I was clear.

Thanks in advance!

Chelo (@mromagnoli)

-- 
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/affb14a1-c703-42b4-973d-b321e6cd99dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.