Term problem


(kunolek) #1

Elasticsearch weird search result?
I have a problem with understanding of ElasticSearch.

Here's my example:

for query:

curl -XPOST 'http://localhost:9200/_search' -d '
{
"query": {
"term": {
"main_place": "katowice"
}
}
}'

i have 0 results, but i have documents with main_place = katowice
i have a clue:

curl -XPOST 'http://localhost:9200/_search' -d '
{
"query": {
"term": {
"main_place": "katowic"
}
}
}'

it gives me results with main_place = katowice and one document with main_place = katowic
i see that problem is with katowic is prefix of katowice

there is no problem with query:

curl -XPOST 'http://localhost:9200/_search' -d '
{
"query": {
"term": {
"main_place": "warszawa"
}
}
}'

i get good results, but there is no "warszaw" in main_places.

I'm waiting for solutions, i know that "text" instead for "term" works, but not with "custom_filter_score" filters.


(system) #2