I have an index with an dynamic object property called "sourceData" which contains various properties. I am trying execute multi_match using phrase type and one of the analyzers we have setup and the fields we must use "sourceData.*" since we do not know all of the possibilities.
looking at the mapping that was created when the data was populated, all properties under "sourceData" contains type: "text" and "keyword"
When I run this, I get an error that Can only use phrase queries on text fields - not on [source.PROPERTYNAME.keyword] which is type [keyword]
Since I do not have all possible "sourceData" properties, I have to use the * in the fields. So, is there a way to exclude all of the [keyword] for each of those properties?
Could you provide the complete error log?
The phrase type in multi_match is a match_phrase query.
If you run match_phrase query do you get the same error?
Do not really need to show the whole error log here. It is a query_shard_exception with the reason "failed to create query: Can only use phrase queries on text fields - not on [sourceData.PROPERTYNAME.keyword]. Since sourceData is a dynamic object, the mapping for each of those fields is text with additional field of keyword.
Since match_phrase does not work on multiple fields and I need to use multiple fields it is not much help here.
The question really is, is there a way to exclude properties from the fields parameter of multi_match.
If it is not possible, then I will have to write custom dynamic template with only text fields and not keyword fields and recreate my index. It is very large index so I don't really want to do this.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.