Some issues with search api v1 and filtering

13 views
Skip to first unread message

Yonatan Rab

unread,
Mar 5, 2019, 5:30:57 PM3/5/19
to Sefaria Project
Hey,

I'm trying to send to following data so ill get results only from "Tanach with Nikkud".
Tried a lot of regex variants and fields name. It seems that path is the only field I manage to filter,,
Cant figure what I'm missing here..

{
"size": 10,
"query": {
"function_score": {
"field_value_factor": {
"field": "pagesheetrank",
"missing": 0.04
},
"query": {
"bool": {
"must": {
"match_phrase": {
"exact": {
"query": "משה"
}
}
},
"filter": {
"bool": {
"should": [
{
"regexp": {
"version": "Tanach with Nikkud"
}
}
]
}
}
}
}
}
}
}

Noah Santacruz

unread,
Mar 6, 2019, 3:38:32 AM3/6/19
to sef...@googlegroups.com
This isn't mentioned in our docs but the `version` field is actually saved as default text field in Elasticsearch. That means you need to specifically access the `keyword` part of the field and query that. The query looks like this:

```
{
    "size": 10,
    "query": {
        "function_score": {
            "field_value_factor": {
                "field": "pagesheetrank",
                "missing": 0.04
            },
            "query": {
                "bool": {
                    "must": {
                        "match_phrase": {
                            "exact": {
                                "query": "משה"
                            }
                        }
                    },
                    "filter": {
                        "bool": {
                            "should": [
                                {
                                    "term": {
                                        "version.keyword": "Tanach with Nikkud"
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        }
    }
}```

--
You received this message because you are subscribed to the Google Groups "Sefaria Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sefaria+u...@googlegroups.com.
To post to this group, send email to sef...@googlegroups.com.
Visit this group at https://groups.google.com/group/sefaria.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages