I am using Elasticsearch 5.1.1. While doing a nested query, it is returning 400 Error
My Doc will look like this
{
"_index" : "test",
"_type" : "test_five",
"_source" : {
"doc" : {
"keyword_elas" : "elasticsearch",
}
},
"doc_as_upsert" : true }
This is my Query Code
{
"query": {
"nested": {
"path":"_source",
"query": {
"nested": {
"path": "_source.doc",
"query": {
"match": {
"_source.doc.keyword_elas": "elasticsearch"
}
}
}
}
}
}}
For the above Query i got an exception
elasticsearch.exceptions.RequestError: TransportError(400, u'search_phase_execution_exception', u'failed to create query: {\n "nested" : {\n "query" : {\n "nested" : {\n
Is this an exception due to some Query Mistake ? or any Version problem...
Thank You
I am not quite sure why you're using a nested query in this environment.
If I have a document like this :
And my goal is to match the
keyword_elas
field. All I would do is :Exact Matches :
Analyzed field :
Note : If you have a document in
keyword_elas
that containselasticsearch ABC
, this query will work because it will be zero fuzziness on the first token (elasticsearch
).For
not analyzed fields
(fully exact match)If you have two documents in your index with
and
The term query will only match the first document.