RGB Color search

I have RGB color values stored in my index.

color: [
{
red: 50
green: 73
blue: 93
}]

I need to be able to find documents in the index that are the the closest
color to the RGB values in a request using Euclidean distance, what is the
best way to achieve this in ElasticSearch?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

You could use function score query and provide calculation of distance as
script, maybe?

Am Donnerstag, 17. Oktober 2013 15:35:30 UTC+2 schrieb dan:

I have RGB color values stored in my index.

color: [
{
red: 50
green: 73
blue: 93
}]

I need to be able to find documents in the index that are the the closest
color to the RGB values in a request using Euclidean distance, what is the
best way to achieve this in Elasticsearch?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hmmm. I love that use case.
Still wondering if color should be a specific type such as geo_point?

Anyhow, I would love to hear how you implement it.

Best

David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 17 oct. 2013 à 15:59, Andrej Rosenheinrich andrej.rosenheinrich@unister.de a écrit :

You could use function score query and provide calculation of distance as script, maybe?

Am Donnerstag, 17. Oktober 2013 15:35:30 UTC+2 schrieb dan:
I have RGB color values stored in my index.

color: [
{
red: 50
green: 73
blue: 93
}]

I need to be able to find documents in the index that are the the closest color to the RGB values in a request using Euclidean distance, what is the best way to achieve this in Elasticsearch?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Thanks, this seems like a good way to do it.

I'm trying to get a simple example of the script_score working, but it
seems like my syntax is wrong;

{
"query" : {
"query_string" : {
"query" : ":"
},
"script_score": {
"lang": "lang",
"script":"_score * 5"
}
}
}

Are there any examples anywhere?

On Thursday, October 17, 2013 2:59:23 PM UTC+1, Andrej Rosenheinrich wrote:

You could use function score query and provide calculation of distance as
script, maybe?

Am Donnerstag, 17. Oktober 2013 15:35:30 UTC+2 schrieb dan:

I have RGB color values stored in my index.

color: [
{
red: 50
green: 73
blue: 93
}]

I need to be able to find documents in the index that are the the closest
color to the RGB values in a request using Euclidean distance, what is the
best way to achieve this in Elasticsearch?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Have a look at function score: Elasticsearch Platform — Find real-time answers at scale | Elastic

It should help

David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 17 oct. 2013 à 21:45, dan dan.tuffery@gmail.com a écrit :

Thanks, this seems like a good way to do it.

I'm trying to get a simple example of the script_score working, but it seems like my syntax is wrong;

{
"query" : {
"query_string" : {
"query" : ":"
},
"script_score": {
"lang": "lang",
"script":"_score * 5"
}
}
}

Are there any examples anywhere?

On Thursday, October 17, 2013 2:59:23 PM UTC+1, Andrej Rosenheinrich wrote:
You could use function score query and provide calculation of distance as script, maybe?

Am Donnerstag, 17. Oktober 2013 15:35:30 UTC+2 schrieb dan:
I have RGB color values stored in my index.

color: [
{
red: 50
green: 73
blue: 93
}]

I need to be able to find documents in the index that are the the closest color to the RGB values in a request using Euclidean distance, what is the best way to achieve this in Elasticsearch?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Thanks David, that link is giving me a 404

On Thursday, October 17, 2013 8:51:02 PM UTC+1, David Pilato wrote:

Have a look at function score:
Elasticsearch Platform — Find real-time answers at scale | Elastic
l

It should help

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

Le 17 oct. 2013 à 21:45, dan <dan.t...@gmail.com <javascript:>> a écrit :

Thanks, this seems like a good way to do it.

I'm trying to get a simple example of the script_score working, but it
seems like my syntax is wrong;

{
"query" : {
"query_string" : {
"query" : ":"
},
"script_score": {
"lang": "lang",
"script":"_score * 5"
}
}
}

Are there any examples anywhere?

On Thursday, October 17, 2013 2:59:23 PM UTC+1, Andrej Rosenheinrich wrote:

You could use function score query and provide calculation of distance as
script, maybe?

Am Donnerstag, 17. Oktober 2013 15:35:30 UTC+2 schrieb dan:

I have RGB color values stored in my index.

color: [
{
red: 50
green: 73
blue: 93
}]

I need to be able to find documents in the index that are the the
closest color to the RGB values in a request using Euclidean distance, what
is the best way to achieve this in Elasticsearch?

--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to elasticsearc...@googlegroups.com <javascript:>.
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

URL is correct but the link I provided when you click on it is wrong.

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 17 oct. 2013 à 22:06, dan dan.tuffery@gmail.com a écrit :

Thanks David, that link is giving me a 404

On Thursday, October 17, 2013 8:51:02 PM UTC+1, David Pilato wrote:
Have a look at function score: Elasticsearch Platform — Find real-time answers at scale | Elastic

It should help

David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 17 oct. 2013 à 21:45, dan dan.t...@gmail.com a écrit :

Thanks, this seems like a good way to do it.

I'm trying to get a simple example of the script_score working, but it seems like my syntax is wrong;

{
"query" : {
"query_string" : {
"query" : ":"
},
"script_score": {
"lang": "lang",
"script":"_score * 5"
}
}
}

Are there any examples anywhere?

On Thursday, October 17, 2013 2:59:23 PM UTC+1, Andrej Rosenheinrich wrote:
You could use function score query and provide calculation of distance as script, maybe?

Am Donnerstag, 17. Oktober 2013 15:35:30 UTC+2 schrieb dan:

I have RGB color values stored in my index.

color: [
{
red: 50
green: 73
blue: 93
}]

I need to be able to find documents in the index that are the the closest color to the RGB values in a request using Euclidean distance, what is the best way to achieve this in Elasticsearch?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearc...@googlegroups.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+unsubscribe@googlegroups.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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

There's an implementation of a colour distance algorithm here:
http://compuphase.com/cmetric.htm

I coded it up as a Lucene query some time ago (don't have the source to
hand currently) and results were OK but had some oddities.
I ended up thinking that a data-gathering exercise via Mechanical Turk or
similar might be a useful exercise to train a better model that accounts
for the quirks in human perception.

Cheers
Mark

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.