Closed kden13 closed 3 years ago
You can try matching author.display_name
instead:
{
"query": {
"bool": {
"should": [
{"match_phrase": {"author.display_name": "Amy Abbott"}}
]
}
},
"include": [
"lens_id",
"authors"
]
}
Thank you very much for the suggestion. It brought back a few of her works. I added her middle initial to the display name and I got them all back.
Any ideas why the author.first_name and author.last_name criteria didn't work?
author.first_name and author.last_name search for first and last name in single document rather than single author node. If the record has one author with last name Abbott and another with first name Amy, it was being included in response.
Again, thank you! That makes perfect sense.
I'm a newbie so forgive me if this is ridiculous. I'm attempting to get all records for a specific author. She sometimes shows up as A. Abbott and sometimes Amy Abbott so I tried this as a POST query:
_"query": { "bool": { "should": [ { "bool": { "must": [ {"match_phrase": {"author.last_name": "Abbott"}}, {"match_phrase": {"author.first_name": "Amy"}} ] } }, { "bool": { "must": [ {"match_phrase": {"author.last_name": "Abbott"}}, {"match_phrase": {"author.initials": "A"}} ] } }, { "bool": { "must": [ {"match_phrase": {"author.last_name": "Abbott"}}, {"match_phrase": {"author.first_name": "A"}} ] } } ] } }, "include":["lensid","authors"]
That returned way too many results that included other Abbotts. I thought I'd simplify by trying this: _"query": { "bool": { "must": [ {"match_phrase": {"author.last_name": "Abbott"}}, {"match_phrase": {"author.first_name": "Amy"}} ] } }, "include":["lensid","authors"]
That returned a similar result as the first query.
I would appreciate your assistance. Thank you!