# Event Fields Comparison Table The event fields used by [agents](https://hackmd.io/Uj-tC7l9Q82VyGr8R5PL2Q#ctxagentseventStoresearchrequest) ```ctx.agents.eventStore.emit()``` and ```search()/searchWithPattern()``` are different. Here we provide a convenient comparison table for you when it comes to searching events. | Field | Emit Events | Search Events | |:------------ |:---------------:|:-----------------------------:| | Source DID | ```sourceDID``` | ```source_digital_identity``` | | Target DID | ```targetDID``` | ```target_digital_identity``` | | Label Name | ```labelName``` | ```label_name``` | | Execution ID | N/A | ```execution_id``` | | Task ID | N/A | ```task_id``` | For example, if you feel like searching events with the source DID of ```ABC```, instead of putting "sourceDID" in the search field, you are supposed to use "source_digital_identity". Below we are using this example in JavaScript to make you better understand how this comparison table works: - Emit an event: we are creating an event whose source DID is ```ABC```. ```javascript ctx.agents.eventStore.emit([ { sourceDID: "ABC", // source DID targetDID: "XYZ", // target DID will be user's name labelName: "Test", // event label (greeting message) meta: "NA", // include user's age in the meta field type: "default", // default group }, ]); ``` - Search the event: we are querying those events whose source DID is ```ABC```. ```javascript async function run(ctx) { // event search parameters // we are using this rather than "sourceDID", the one we used in emitting an event const searchReq = { queries: [ { Match: { field: "source_digital_identity", value: "ABC", }, }, ], excludes: [], filters: [], from: 0, size: 1000, sorts: [], }; // search events that match and extract event objects const search = await ctx.agents.eventStore.search(searchReq); const events = search?.events; ``` Based on these examples, it would be easy to apply the same rule to other items - all you need to do is to follow the the comparison table above. --- ###### tags: `LOC Studio` `LOC CLI`