Reputation: 4278
I'm using ElasticSearch 2.3.3.
I have the following mapping:
"mappings": {
"entries": {
"dynamic": "strict",
"properties": {
"Data": {
"properties": {
"FirstName": {
"type": "string",
"index": "not_analyzed"
}
}
}
}
}
}
I have the following query:
POST /frm4356/entries/_search
{
"query" : {
"match" : {"Data.FirstName" : "BBB"}
}
}
Which works fine and yields the following response:
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 1,
"hits": [
{
"_index": "frm4356_v3",
"_type": "entries",
"_id": "57c867715f7ecd2a78610ec6",
"_score": 1,
"_source": {
"Data": {
"FirstName": "BBB"
}
}
}
]
}
}
I tried to used the "Explain API" but failed miserably.
The following did not work:
Attempt #1
POST /frm4356/entries/_explain
{
"query" : {
"match" : {"Data.FirstName" : "BBB"}
}
}
Attempt #2:
POST /frm4356/entries/_search
{
"explain" : true,
"query" : {
"match" : {"Data.FirstName" : "BBB"}
}
}
In both cases, I keep getting this response:
{
"error": {
"root_cause": [
{
"type": "strict_dynamic_mapping_exception",
"reason": "mapping set to strict, dynamic introduction of [query] within [entries] is not allowed"
}
],
"type": "strict_dynamic_mapping_exception",
"reason": "mapping set to strict, dynamic introduction of [query] within [entries] is not allowed"
},
"status": 400
}
What am I doing wrong ? I'd like to see the explanation of the query.
Upvotes: 0
Views: 2725
Reputation: 649
Here's the official documentation for Explain API.
It looks like you missed the _id there.
POST /frm4356/entries/57c867715f7ecd2a78610ec6/_explain
{
"query": {
"match": {
"Data.FirstName": "BBB"
}
}
}
Upvotes: 0
Reputation: 868
Try something like this:
GET /blog/post/_validate/query?explain
{
"query": {
"match": {
"title": "Smith"
}
}
}
Upvotes: 2