I have the following document in my collection
> {
"_id": "101", "PublisherName": "Big book publishers", "Books": [ { "_id": "6791913210", "Title": "Piano made simple", "Author": "John Bent" }, { "_id": "6638200210", "Title": "Guitar made simple", "Author": "Kim Larry" } ] }
Ive defined the search index as follows
{
“mappings”: {
“dynamic”: false,
“fields”: {
“PublisherName”: {
“analyzer”: “lucene.standard”,
“type”: “string”
},
“Books”: {
“dynamic”: false,
“fields”: {
“Author”: {
“analyzer”: “lucene.standard”,
“type”: “string”
}
},
“type”: “embeddedDocuments”
}
}
}
}
I can search in the PublisherName or Author fields using seperate search definition
[Search PublisherName]
{
“index”: “book-search-Index”,
“compound”: {
“should”: [
{
“text”: {
“query”: “Big book publishers”,
“path”: [
“PublisherName”
]
}
}
]
}
}
or
[Search Books.Author]
> {
"index": "book-search-Index", "embeddedDocument": { "path": "Books", "operator": { "compound": { "should": [ { "text": { "path": ["Books.Author"], "query": "Guitar" } } ] } } } }
But im not able to define one search defination that is capable for searching both the PublisherName filed and Book.Author field. I tried the below but im getting error
“Reason: at most one of [autocomplete, compound, embeddedDocument, equals, exists, geoShape, geoWithin, in, knnBeta, moreLikeThis, near, phrase, queryString, range, regex, search, span, term, text, wildcard] may be present”
{
“index”: “book-search-Index”,
“compound”: {
“should”: [
{
“text”: {
“query”: “jonas”,
“path”: [
“BoardName”
],
“score”: {
“boost”: {
“value”: 1.0
}
}
}
}
]
},
“embeddedDocument”: {
“path”: “ClipCompliance”,
“operator”: {
“compound”: {
“should”: [
{
“text”: {
“path”: [“ClipCompliance.Contributors”,“ClipCompliance.Guidance”],
“query”: “required”
}
}
]
}
}
}
}