I am using the Node Elasticsearch client from inside Node Express, and I constructed a query that generates the following error:
(node:85104) ResponseError: mapper_parsing_exception: [mapper_parsing_exception] Reason: object mapping for [data] tried to parse field [data] as object, but found a concrete value at onBody
The error occurs after the call to search returns the correct result.
The query is built as follows:
const query = {
_source: false,
query: {
bool: {
filter: [
{ term: { owner: user }},
{ terms: { type: [ 'TEXT', 'MEDI' ]}}
]
}
},
fields: [ 'serial', 'tags' ]
}
The value user
is a number. There is a field named data
in the documents, mapped as an object
. However all instances of this field are in fact an object.
Further, there is no error if I do the exact same query via the Kibana devtool. It returns the same set of documents that the javascript call does. This suggests to me either:
- The error is in the node client.
- The error is not visible from the Kibana client.
I am looking for some suggestion as to where this error is coming from and how to solve it. Any help appreciated.