1
votes

Good day, I have a project with elasticsearch and tire gem. I have a facet, that returns me letters.

facet "some" do
  terms :letter, :order => 'term', :size => 99999
  facet_filter :term, id: id
end

I have a output of search query like

{
  "_index": "some",
  "_type": "some",
  "_id": "210",
  "_score": 1,
  "_source": {
  "id": 1,
  "letter": "p"
  }
}

And many more other records. It's working nearly ok, but if letter is 'a', facet doesn't want to return it to me. I think, it pushes it to "missing".

"facets": {
  "fac": {
     "_type": "terms",
     "missing": 27,
     "total": 261,
     "other": 0,
     "terms": [

Sounds like a magic. Where can be the problem? And how can I look through missing records? (I'm using Sense extension to work with ES faster)

1
Could it be that the letter field has a stop filter on it which is removing the word "a"?Shadwell
Or indeed uses an analyzer that includes a stop filter by default (e.g. standard or snowball)Shadwell
so, as I understood, it had a stop filter. I made letter output as "a_letter", "b_letter" etc and it worked for me.AKovtunov

1 Answers

0
votes

As I understood, it had some filter which is removing the letter "a". I rewrite method, that returns my first letters, so my new output was "a_letter", "b_letter" etc. and it worked for me. Thanks @Shadwell for help.