Hi!
I have mapping that contains a title
and note
field, in addition to a links_to_asset
field:
"links_to_asset": {
"type": "nested",
"properties": {
"comment": {
"type": "text",
"fields": {
"std": {
"type": "text",
"fields": {
"std": {
"type": "text",
"analyzer": "standard"
}
},
"analyzer": "asset_en_analyzer"
}
}
},
"creation": {
"type": "date",
"format": "date_hour_minute_second"
},
"from_asset": {
"type": "integer"
},
"modification": {
"type": "date",
"format": "date_hour_minute_second"
},
"note_link_id": {
"type": "long"
},
"to_asset": {
"type": "integer"
},
"user_id": {
"type": "long"
}
}
}
... where the from_asset
and to_asset
fields are equal to the _id
field values in documents.
So far, I have:
{
"query": {
"nested": {
"path": "links_to_asset",
"query": {
"bool": {
"must": {
"match": {
"links_to_asset.comment": "research suggests chaotic"
}
}
}
}
}
}
}
... which is working, but I'm struggling with a few things:
- is it possible to restrict the search to documents by their
_id
anduser_id
fields; - and is it possible to search the
title
fields of the documents belonging to thefrom_asset
andto_asset
fields?
I've been experimenting but with no success (I'm unable to combine function_score
with nested
, as an example).