Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

ElasticSearch returns empty hits if filtering by some field

$
0
0

I am new to Elastic Search, so any tips or hints are appreciated!

I have an index where I want to retrieve some entries that match exactly some values of the field called "my_id".

These are my attempts:Query 1:

{"min_score": 1,"query": {"bool": {"must": [        {"terms": {"project": ["one"]          }        }      ],"filter": [        { "terms": { "my_id": ["my_id_2", "my_id_1"] } }      ]    }   }}

-> returns empty hits.

Query 2:

{"min_score": 1,"query": {"bool": {"must": [        {"terms": {"project": ["one"]          }        }      ]    , "should": [      {"match": {"my_id": "my_id_1"          }        },        {"match": {"my_id": "my_id_2"          }        }      ]    }   }}

-> returns more entries than the entries with given my_id.

I am at loss here and do not see what could be wrong. Do I have to have a look at analyzers? If it is text or keyword based setup? If so, how do you check these and change these?

Thanks in advance for every answer and comment!

Edit:

This is the field type:

"my_id": {"type": "text","fields": {"keyword": {"type": "keyword","ignore_above": 256            }          }        },

Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>