-
-
Save alebsack/fc8f0b377c1ca1e780fd to your computer and use it in GitHub Desktop.
Multiple facets error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[2013-04-25 13:08:59,346][DEBUG][action.search.type ] [Human Robot] [directory_users][3], node[q90bIsQ_RwaB7kn4qpwziQ], [P], s[STARTED]: Failed to execute [org.elasticsearch.action.search.SearchRequest@29c114f2] | |
org.elasticsearch.search.SearchParseException: [directory_users][3]: query[ConstantScore(NotDeleted(+cache(customer_id:bd9058f4-bf18-416c-8e0d-07e1a1c9819a)))],from[-1],size[-1]: Parse Failure [Failed to parse source [{ | |
"query": { | |
"filtered": { | |
"filter": { | |
"and": [ | |
{ | |
"term": { | |
"customer_id": "bd9058f4-bf18-416c-8e0d-07e1a1c9819a" | |
} | |
} | |
] | |
}, | |
"query": { | |
"match_all": {} | |
} | |
} | |
}, | |
"facets": { | |
"inactive_1w": { | |
"range": { | |
"field": "last_seen_at", | |
"ranges": { | |
"ranges": [ | |
{ | |
"to": "2013-04-18T13:04:58+01:00" | |
} | |
] | |
} | |
} | |
}, | |
"inactive_2w": { | |
"range": { | |
"field": "last_seen_at", | |
"ranges": { | |
"ranges": [ | |
{ | |
"to": "2013-04-11T13:04:58+01:00" | |
} | |
] | |
} | |
} | |
} | |
}, | |
"size": 1000 | |
}]] | |
at org.elasticsearch.search.SearchService.parseSource(SearchService.java:566) | |
at org.elasticsearch.search.SearchService.createContext(SearchService.java:481) | |
at org.elasticsearch.search.SearchService.createContext(SearchService.java:466) | |
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:236) | |
at org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:141) | |
at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80) | |
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:205) | |
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:192) | |
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:178) | |
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) | |
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) | |
at java.lang.Thread.run(Thread.java:680) | |
Caused by: org.elasticsearch.search.SearchParseException: [directory_users][3]: query[ConstantScore(NotDeleted(+cache(customer_id:bd9058f4-bf18-416c-8e0d-07e1a1c9819a)))],from[-1],size[-1]: Parse Failure [No parser for element [inactive_2w]] | |
at org.elasticsearch.search.SearchService.parseSource(SearchService.java:552) | |
... 11 more |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X GET 'http://127.0.0.1:9200/directory_users/directory_user/_search?size=1000&pretty' -d '{ | |
"query": { | |
"filtered": { | |
"filter": { | |
"and": [ | |
{ | |
"term": { | |
"customer_id": "bd9058f4-bf18-416c-8e0d-07e1a1c9819a" | |
} | |
} | |
] | |
}, | |
"query": { | |
"match_all": {} | |
} | |
} | |
}, | |
"facets": { | |
"inactive_1w": { | |
"range": { | |
"field": "last_seen_at", | |
"ranges": { | |
"ranges": [ | |
{ | |
"to": "2013-04-18T13:04:58+01:00" | |
} | |
] | |
} | |
} | |
}, | |
"inactive_2w": { | |
"range": { | |
"field": "last_seen_at", | |
"ranges": { | |
"ranges": [ | |
{ | |
"to": "2013-04-11T13:04:58+01:00" | |
} | |
] | |
} | |
} | |
} | |
}, | |
"size": 1000 | |
}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
customer_id = customer.id | |
result = DirectoryUser.search(:per_page => MAX_RESULTS) do | |
query do | |
filtered do | |
query { all } | |
filter :term, :customer_id => customer_id | |
end | |
end | |
facet 'inactive_1w' do | |
range :last_seen_at, :ranges => [{:to => 1.week.ago}] | |
end | |
facet 'inactive_2w' do | |
range :last_seen_at, :ranges => [{:to => 2.weeks.ago}] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment