I have a rather 'complex' elasticsearch document that has spaces present in the path. Is there any way in which to get the query working without a reindex? :)
"_source": {
"threads": {
"MANAGEMENT DISCUSSION SECTION": [],
"Q&A": [
{
"sentence_sentiment": [
{
"sentiment": {...}
}
],...
My current code looks something like this.
def query_nested(path='threads.Q&A', to_match=None, *args, **kwargs):
q_match = None
if to_match:
for match in to_match:
if q_match is None:
q_match = Q("match", **match)
else:
q_match &= Q("match", **match)
q = Q("nested", path=path,
query=q_match,
inner_hits={})
s = Search()[kwargs.get('start', 0):kwargs.get('end', 25)]
s = s.query(q)
s = s.source(include=["title"])
s = s.sort('-year', '-month', '-day')
return s.execute()
return None
But this results in an incorrect query due to the .Q&A of course.
I also tried with threads["Q&A"] but that doesn't work either.
Ideally, I don't want to reindex since the collection is really quite large.