ES sorting not working when use min_score in query


(vallabh) #1

Hello Friends,

When i use "min_score" in my query sorting stop working.
Also min_score displays only 10 results?

Below is my code,

$result = $es->search(array(
"query" => array(
"dis_max" => array(
"queries" => array(
0 => array(
"field" => array(
"title" => $search
)
)
)
),
"min_score" => 0.5
),
"from" => 0,
"size" => 100000,
"filter" => array(
"geo_distance" => array(
"distance" => "10000mi",
"jos_content.location" => array(
"lat" => $lat,
"lon" => $lon
)
)
),
"sort" => array(
0 => array(
"_geo_distance" => array(
"jos_content.location" => array(
"lat" => $lat,
"lon" => $lon
),
"order" => "asc",
"unit" => "km"
)
),
1 => "_score"
)
)
);

Any help is very much appreciated

Thanks,
Vallabh

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/64245c51-c2ef-42c4-941c-a2add312cfce%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Alexander Reelsen) #2

Hey,

can you provide a minimal example using curl, so people can reproduce it
using commandline tools and do not need a programming language and its
environment? See http://www.elasticsearch.org/help

A quick test was not revealing any suspicious behaviour to me, but maybe
you are doing something different.
Also, what do you mean with 'stops working' - maybe the score is too low to
be including then? Would be great if you could be more specifc.

Thanks!

--Alex

On Tue, Feb 11, 2014 at 12:09 PM, Vallabh Bothre
vallabh.bothre@gmail.comwrote:

Hello Friends,

When i use "min_score" in my query sorting stop working.
Also min_score displays only 10 results?

Below is my code,

$result = $es->search(array(
"query" => array(
"dis_max" => array(
"queries" => array(
0 => array(
"field" => array(
"title" => $search
)
)
)
),
"min_score" => 0.5
),
"from" => 0,
"size" => 100000,
"filter" => array(
"geo_distance" => array(
"distance" => "10000mi",
"jos_content.location" => array(
"lat" => $lat,
"lon" => $lon
)
)
),
"sort" => array(
0 => array(
"_geo_distance" => array(
"jos_content.location" => array(
"lat" => $lat,
"lon" => $lon
),
"order" => "asc",
"unit" => "km"
)
),
1 => "_score"
)
)
);

Any help is very much appreciated

Thanks,
Vallabh

--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/64245c51-c2ef-42c4-941c-a2add312cfce%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGCwEM9iUU5DCd5qJE6jAJbU2fsphxGXeqvQiQNzyhi_xzUMLQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(vallabh) #3

Thanks for replying Alex,

You can see my below code so that you can come to know what i am using,

--Creating the index first,
curl -X PUT 'http://localhost:9200/adminvenue/?pretty=true' -d '
{
"settings" : {
"analysis" : {
"analyzer" : {
"venue_analyzer" : {
"tokenizer" : "standard",
"filter" : ["standard", "lowercase", "venue_metaphone",
"asciifolding"]
}
},
"filter" : {
"venue_metaphone" : {
"type" : "phonetic",
"encoder" : "metaphone",
"replace" : false
}
}
}
}
}

--Mapping done here
curl -X PUT '
http://localhost:9200/adminvenue/jos_content/_mapping?pretty=true' -d '
{
"jos_content" : {
"properties" : {

  "title" : {
  "type": "string",
  "index_analyzer": "venue_analyzer",
  "search_analyzer": "venue_analyzer"
  },
  "location" : {

"type" : "geo_point",
"lat_lon": true
}

}

}
}

You can search result through browser or by curl, but it is just simple
search, i am using the above $es->search code because i wanted to search
relaevant data with nearest distance
http://localhost:9200/adminvenue/jos_content/_search?q=title:palexpo

Sorting stops working means, when i search the data i am sorting
using _geo_distance location.
So when i get the result it gives me nearest distance of 2 latitude
longitude.
But when i used min_score, i didnot get the nearest distance in the result
also it gives only 10 results though in the total it is some what more.
I am using min_score to remove the non-relevant result.

Thanks,
Vallabh

On Tuesday, February 11, 2014 7:20:52 PM UTC+5:30, Alexander Reelsen wrote:

Hey,

can you provide a minimal example using curl, so people can reproduce it
using commandline tools and do not need a programming language and its
environment? See http://www.elasticsearch.org/help

A quick test was not revealing any suspicious behaviour to me, but maybe
you are doing something different.
Also, what do you mean with 'stops working' - maybe the score is too low
to be including then? Would be great if you could be more specifc.

Thanks!

--Alex

On Tue, Feb 11, 2014 at 12:09 PM, Vallabh Bothre <vallabh...@gmail.com<javascript:>

wrote:

Hello Friends,

When i use "min_score" in my query sorting stop working.
Also min_score displays only 10 results?

Below is my code,

$result = $es->search(array(
"query" => array(
"dis_max" => array(
"queries" => array(
0 => array(
"field" => array(
"title" => $search
)
)
)
),
"min_score" => 0.5
),
"from" => 0,
"size" => 100000,
"filter" => array(
"geo_distance" => array(
"distance" => "10000mi",
"jos_content.location" => array(
"lat" => $lat,
"lon" => $lon
)
)
),
"sort" => array(
0 => array(
"_geo_distance" => array(
"jos_content.location" => array(
"lat" => $lat,
"lon" => $lon
),
"order" => "asc",
"unit" => "km"
)
),
1 => "_score"
)
)
);

Any help is very much appreciated

Thanks,
Vallabh

--
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/64245c51-c2ef-42c4-941c-a2add312cfce%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/a75c11f3-d489-42ec-9916-b441803449f1%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Alexander Reelsen) #4

Hey,

you provided the mapping and the index creation calls. In order to really
reproduce something it would great, if you could also provide a couple of
documents you created, including the correct geo coordinates.

I have an assumption, which I cannot back up due to missing data now: When
you are sorting by geo values (and using unit in km) you might be excluding
everything, which is more distanced than 0.5 km (being the min score) from
the geo point you defined for sorting. Do you intend to do that?

--Alex

On Wed, Feb 12, 2014 at 7:57 AM, Vallabh Bothre vallabh.bothre@gmail.comwrote:

Thanks for replying Alex,

You can see my below code so that you can come to know what i am using,

--Creating the index first,
curl -X PUT 'http://localhost:9200/adminvenue/?pretty=true' -d '
{
"settings" : {
"analysis" : {
"analyzer" : {
"venue_analyzer" : {
"tokenizer" : "standard",
"filter" : ["standard", "lowercase",
"venue_metaphone", "asciifolding"]
}
},
"filter" : {
"venue_metaphone" : {
"type" : "phonetic",
"encoder" : "metaphone",
"replace" : false
}
}
}
}
}

--Mapping done here
curl -X PUT 'http://localhost:9200/adminvenue/jos_content/_
mapping?pretty=true' -d '
{
"jos_content" : {
"properties" : {

  "title" : {
  "type": "string",
  "index_analyzer": "venue_analyzer",
  "search_analyzer": "venue_analyzer"
  },
  "location" : {

"type" : "geo_point",
"lat_lon": true
}

}

}
}

You can search result through browser or by curl, but it is just simple
search, i am using the above $es->search code because i wanted to search
relaevant data with nearest distance
http://localhost:9200/adminvenue/jos_content/_search?q=title:palexpo

Sorting stops working means, when i search the data i am sorting
using _geo_distance location.
So when i get the result it gives me nearest distance of 2 latitude
longitude.
But when i used min_score, i didnot get the nearest distance in the result
also it gives only 10 results though in the total it is some what more.
I am using min_score to remove the non-relevant result.

Thanks,
Vallabh

On Tuesday, February 11, 2014 7:20:52 PM UTC+5:30, Alexander Reelsen wrote:

Hey,

can you provide a minimal example using curl, so people can reproduce it
using commandline tools and do not need a programming language and its
environment? See http://www.elasticsearch.org/help

A quick test was not revealing any suspicious behaviour to me, but maybe
you are doing something different.
Also, what do you mean with 'stops working' - maybe the score is too low
to be including then? Would be great if you could be more specifc.

Thanks!

--Alex

On Tue, Feb 11, 2014 at 12:09 PM, Vallabh Bothre vallabh...@gmail.comwrote:

Hello Friends,

When i use "min_score" in my query sorting stop working.
Also min_score displays only 10 results?

Below is my code,

$result = $es->search(array(
"query" => array(
"dis_max" => array(
"queries" => array(
0 => array(
"field" => array(
"title" => $search
)
)
)
),
"min_score" => 0.5
),
"from" => 0,
"size" => 100000,
"filter" => array(
"geo_distance" => array(
"distance" => "10000mi",
"jos_content.location" => array(
"lat" => $lat,
"lon" => $lon
)
)
),
"sort" => array(
0 => array(
"_geo_distance" => array(
"jos_content.location" => array(
"lat" => $lat,
"lon" => $lon
),
"order" => "asc",
"unit" => "km"
)
),
1 => "_score"
)
)
);

Any help is very much appreciated

Thanks,
Vallabh

--
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/64245c51-c2ef-42c4-941c-a2add312cfce%
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/a75c11f3-d489-42ec-9916-b441803449f1%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGCwEM8qbNuKx%3D%2BnfXR21czrMAB6M7%2BR8Maaqe87bio0NbARvw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #5