Ich indexiere ein Anhangsfeld. Die POST-Abfrage im Sinne gibt erwartete Ergebnismenge zurück. Meine Frage istKein Ergebnis von der Verschachtelung zurückgegeben C# elasticsearch query
POST /mydocs/_search
{
"query" : {
"bool" : {
"must" : [
{ "match" : { "file.content":"abc"} },
{ "match":{"otherDetails":"asd"}},
{ "match" : { "filePermissionInfo.accountValue" : "xyz"} }
]
}
}
}
Ich brauche es zu einem C# Nest Code zu konvertieren. Ich habe versucht, es zu konvertieren, aber es liefert kein Ergebnis, auch wenn es Daten enthält. Wenn ich die
von der unten genannten Erfahrung entferne, gibt es eine Ergebnismenge zurück. Gibt es ein Problem mit dem Attachement-Feld?
client.Search<IndexDocument>(s => s
.Index("mydocs")
.Query(q => q
.Bool(b => b
.Must(m =>
m.Match(mt1 => mt1.Field(f1 => f1.File.Coontent).Query(queryTerm)) &&
m.Match(mt2 => mt2.Field(f2 => f2.FilePermissionInfo.First().SecurityIdValue).Query(accountName)) &&
m.Match(mt3 => mt3.Field(f3 => f3.OtherDetails).Query(other))
)))
);
Mein Mapping ist
{
"mydocs": {
"mappings": {
"indexdocument": {
"properties": {
"docLocation": {
"type": "string",
"index": "not_analyzed",
"store": true
},
"documentType": {
"type": "string",
"store": true
},
"file": {
"type": "attachment",
"fields": {
"content": {
"type": "string",
"term_vector": "with_positions_offsets",
"analyzer": "full"
},
"author": {
"type": "string"
},
"title": {
"type": "string",
"term_vector": "with_positions_offsets",
"analyzer": "full"
},
"name": {
"type": "string"
},
"date": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
},
"keywords": {
"type": "string"
},
"content_type": {
"type": "string"
},
"content_length": {
"type": "integer"
},
"language": {
"type": "string"
}
}
},
"filePermissionInfo": {
"properties": {
"fileSystemRights": {
"type": "string",
"store": true
},
"securityIdValue": {
"type": "string",
"store": true
}
}
},
"id": {
"type": "double",
"store": true
},
"lastModifiedDate": {
"type": "date",
"store": true,
"format": "strict_date_optional_time||epoch_millis"
},
"otherDetails": {
"type": "string"
},
"title": {
"type": "string",
"store": true,
"term_vector": "with_positions_offsets"
}
}
}
}
}
}
Ich aktualisierte die Abfrage, aber immer noch kein Ergebnis zurückgegeben. Kannst du mir bitte helfen, die Anfrage korrekt an Nest zu übertragen –
@AjA - aber ich weiß nicht, was deine Daten sind und was du versuchst :) Ich würde die einzelnen Abfragekomponenten Stück für Stück aufschlüsseln um zu verstehen wie jeder zum Endergebnis beiträgt. Wenn Sie ein bestimmtes Dokument haben, von dem Sie denken, dass es für eine bestimmte Abfrage passen sollte, können Sie das API '_explain' verwenden, um zu verstehen, warum es stimmt oder nicht - https://www.elastic.co/guide/en/elasticsearch /reference/current/search-explain.html –