Elastic Search: How to extract All “FieldNames” that Match the Query Phrase/Stringelastic search matching issueElastic search does not return query result for indexed fieldElastic Search: find document by analyzed field only if all words from field are contained in queryElastic search nest search queryElastic search nest dynamic query with object initializer NEST 5.xMatchphrase Query Elastic Search not working as expectedc# nest for elasticsearch: how to convert query that updates particular field of elastic search document to nest?Elastic search query from JSON formatted string?Elastic Search nested object queryElastic Search MoreLikeThis Query Never Returns Results
AsyncDictionary - Can you break thread safety?
Is this n-speak?
ParseJSON using SSJS
On math looking obvious in retrospect
PhD advisor lost funding, need advice
How far did Gandalf and the Balrog drop from the bridge in Moria?
Is it okay for a ticket seller in the USA to refuse to give you your change, keep it for themselves and claim it's a tip?
What ability do tools use?
Heating Margarine in Pan = loss of calories?
Why I have higher ping to the VLAN interface than to other local interfaces
How to remove threat that antivirus program indicates has to be manually deleted?
Bitcoin successfully deducted on sender wallet but did not reach receiver wallet
The cat ate your input again!
How to describe accents?
How can Radagast come across Gandalf and Thorin's company?
How do some PhD students get 10+ papers? Is that what I need for landing good faculty position?
how do companies get money from being listed publicly
is this F 6'9 chord a figured bass or a chord extension?
Can sampling rate be a floating point number?
First amendment and employment: Can a police department terminate an officer for speech?
Why are Gatwick's runways too close together?
Is it legal for a company to enter an agreement not to hire employees from another company?
Why did I get only 5 points even though I won?
How to take the beginning and end parts of a list with simpler syntax?
Elastic Search: How to extract All “FieldNames” that Match the Query Phrase/String
elastic search matching issueElastic search does not return query result for indexed fieldElastic Search: find document by analyzed field only if all words from field are contained in queryElastic search nest search queryElastic search nest dynamic query with object initializer NEST 5.xMatchphrase Query Elastic Search not working as expectedc# nest for elasticsearch: how to convert query that updates particular field of elastic search document to nest?Elastic search query from JSON formatted string?Elastic Search nested object queryElastic Search MoreLikeThis Query Never Returns Results
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to extract the field names where the search text appears in the elastic search (stored) indexed documents.
Is this type of querying possible in elastic search, I am using Nest Client in C#
Please refer to the example below:
Example: employee document
"first_name" : "emp first",
"last_name" : "emp last"
Input search text: "first"
Expected out : ["first_name"]
Input search text : "emp"
Expected output : ["first_name", "last_name"]
Thanks,
AT
c#
add a comment |
I want to extract the field names where the search text appears in the elastic search (stored) indexed documents.
Is this type of querying possible in elastic search, I am using Nest Client in C#
Please refer to the example below:
Example: employee document
"first_name" : "emp first",
"last_name" : "emp last"
Input search text: "first"
Expected out : ["first_name"]
Input search text : "emp"
Expected output : ["first_name", "last_name"]
Thanks,
AT
c#
add a comment |
I want to extract the field names where the search text appears in the elastic search (stored) indexed documents.
Is this type of querying possible in elastic search, I am using Nest Client in C#
Please refer to the example below:
Example: employee document
"first_name" : "emp first",
"last_name" : "emp last"
Input search text: "first"
Expected out : ["first_name"]
Input search text : "emp"
Expected output : ["first_name", "last_name"]
Thanks,
AT
c#
I want to extract the field names where the search text appears in the elastic search (stored) indexed documents.
Is this type of querying possible in elastic search, I am using Nest Client in C#
Please refer to the example below:
Example: employee document
"first_name" : "emp first",
"last_name" : "emp last"
Input search text: "first"
Expected out : ["first_name"]
Input search text : "emp"
Expected output : ["first_name", "last_name"]
Thanks,
AT
c#
c#
asked Mar 27 at 9:01
aditya eceaditya ece
12 bronze badges
12 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
There is a feature in elasticsearch "Named Queries", you can named each query and elasticsearch will return the matched queries names
For your case you can use this query
GET index/doc_type/_search
"_source": [
"first_name",
"last_name"
],
"query":
"bool":
"should": [
"match":
"first_name":
"query": "emp",
"_name": "first_name"
,
"match":
"last_name":
"query": "emp",
"_name": "last_name"
]
Elasticsearch will return result like this one
"took": 90,
"timed_out": false,
"_shards":
"total": 5,
"successful": 5,
"failed": 0
,
"hits":
"total": 1,
"max_score": 16.399673,
"hits": [
"_index": "index",
"_type": "doc_type",
"_id": "1",
"_score": 16.399673,
"_routing": "1",
"_source":
"first_name": "emp first",
"last_name": "emp last"
,
"matched_queries": [
"first_name",
"last_name"
]
]
You can also do the same thing with highlighting
GET index/doc_type/_search
"_source": [
"first_name",
"last_name"
],
"query":
"bool":
"should": [
"match":
"first_name": "emp"
,
"match":
"last_name": "emp"
]
,
"highlight":
"fields":
"first_name": ,
"last_name" :
Sample Response :
"took": 90,
"timed_out": false,
"_shards":
"total": 5,
"successful": 5,
"failed": 0
,
"hits":
"total": 1,
"max_score": 16.399673,
"hits": [
"_index": "index",
"_type": "doc_type",
"_id": "1",
"_score": 16.399673,
"_routing": "1",
"_source":
"first_name": "emp first",
"last_name": "emp last"
,
"highlight": [
"first_name" : ["<em>emp</em> first"],
"last_name" : ["<em>emp</em> last"]
]
]
Thanks I'll read and verify the same. Also there is other feature 'highlighting' , this also might do a similar job, I have to find out yet.
– aditya ece
Mar 29 at 8:44
@adityaece Yes. You can also do it with the highlighting
– Ashraful Islam
Mar 29 at 8:58
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55373265%2felastic-search-how-to-extract-all-fieldnames-that-match-the-query-phrase-stri%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
There is a feature in elasticsearch "Named Queries", you can named each query and elasticsearch will return the matched queries names
For your case you can use this query
GET index/doc_type/_search
"_source": [
"first_name",
"last_name"
],
"query":
"bool":
"should": [
"match":
"first_name":
"query": "emp",
"_name": "first_name"
,
"match":
"last_name":
"query": "emp",
"_name": "last_name"
]
Elasticsearch will return result like this one
"took": 90,
"timed_out": false,
"_shards":
"total": 5,
"successful": 5,
"failed": 0
,
"hits":
"total": 1,
"max_score": 16.399673,
"hits": [
"_index": "index",
"_type": "doc_type",
"_id": "1",
"_score": 16.399673,
"_routing": "1",
"_source":
"first_name": "emp first",
"last_name": "emp last"
,
"matched_queries": [
"first_name",
"last_name"
]
]
You can also do the same thing with highlighting
GET index/doc_type/_search
"_source": [
"first_name",
"last_name"
],
"query":
"bool":
"should": [
"match":
"first_name": "emp"
,
"match":
"last_name": "emp"
]
,
"highlight":
"fields":
"first_name": ,
"last_name" :
Sample Response :
"took": 90,
"timed_out": false,
"_shards":
"total": 5,
"successful": 5,
"failed": 0
,
"hits":
"total": 1,
"max_score": 16.399673,
"hits": [
"_index": "index",
"_type": "doc_type",
"_id": "1",
"_score": 16.399673,
"_routing": "1",
"_source":
"first_name": "emp first",
"last_name": "emp last"
,
"highlight": [
"first_name" : ["<em>emp</em> first"],
"last_name" : ["<em>emp</em> last"]
]
]
Thanks I'll read and verify the same. Also there is other feature 'highlighting' , this also might do a similar job, I have to find out yet.
– aditya ece
Mar 29 at 8:44
@adityaece Yes. You can also do it with the highlighting
– Ashraful Islam
Mar 29 at 8:58
add a comment |
There is a feature in elasticsearch "Named Queries", you can named each query and elasticsearch will return the matched queries names
For your case you can use this query
GET index/doc_type/_search
"_source": [
"first_name",
"last_name"
],
"query":
"bool":
"should": [
"match":
"first_name":
"query": "emp",
"_name": "first_name"
,
"match":
"last_name":
"query": "emp",
"_name": "last_name"
]
Elasticsearch will return result like this one
"took": 90,
"timed_out": false,
"_shards":
"total": 5,
"successful": 5,
"failed": 0
,
"hits":
"total": 1,
"max_score": 16.399673,
"hits": [
"_index": "index",
"_type": "doc_type",
"_id": "1",
"_score": 16.399673,
"_routing": "1",
"_source":
"first_name": "emp first",
"last_name": "emp last"
,
"matched_queries": [
"first_name",
"last_name"
]
]
You can also do the same thing with highlighting
GET index/doc_type/_search
"_source": [
"first_name",
"last_name"
],
"query":
"bool":
"should": [
"match":
"first_name": "emp"
,
"match":
"last_name": "emp"
]
,
"highlight":
"fields":
"first_name": ,
"last_name" :
Sample Response :
"took": 90,
"timed_out": false,
"_shards":
"total": 5,
"successful": 5,
"failed": 0
,
"hits":
"total": 1,
"max_score": 16.399673,
"hits": [
"_index": "index",
"_type": "doc_type",
"_id": "1",
"_score": 16.399673,
"_routing": "1",
"_source":
"first_name": "emp first",
"last_name": "emp last"
,
"highlight": [
"first_name" : ["<em>emp</em> first"],
"last_name" : ["<em>emp</em> last"]
]
]
Thanks I'll read and verify the same. Also there is other feature 'highlighting' , this also might do a similar job, I have to find out yet.
– aditya ece
Mar 29 at 8:44
@adityaece Yes. You can also do it with the highlighting
– Ashraful Islam
Mar 29 at 8:58
add a comment |
There is a feature in elasticsearch "Named Queries", you can named each query and elasticsearch will return the matched queries names
For your case you can use this query
GET index/doc_type/_search
"_source": [
"first_name",
"last_name"
],
"query":
"bool":
"should": [
"match":
"first_name":
"query": "emp",
"_name": "first_name"
,
"match":
"last_name":
"query": "emp",
"_name": "last_name"
]
Elasticsearch will return result like this one
"took": 90,
"timed_out": false,
"_shards":
"total": 5,
"successful": 5,
"failed": 0
,
"hits":
"total": 1,
"max_score": 16.399673,
"hits": [
"_index": "index",
"_type": "doc_type",
"_id": "1",
"_score": 16.399673,
"_routing": "1",
"_source":
"first_name": "emp first",
"last_name": "emp last"
,
"matched_queries": [
"first_name",
"last_name"
]
]
You can also do the same thing with highlighting
GET index/doc_type/_search
"_source": [
"first_name",
"last_name"
],
"query":
"bool":
"should": [
"match":
"first_name": "emp"
,
"match":
"last_name": "emp"
]
,
"highlight":
"fields":
"first_name": ,
"last_name" :
Sample Response :
"took": 90,
"timed_out": false,
"_shards":
"total": 5,
"successful": 5,
"failed": 0
,
"hits":
"total": 1,
"max_score": 16.399673,
"hits": [
"_index": "index",
"_type": "doc_type",
"_id": "1",
"_score": 16.399673,
"_routing": "1",
"_source":
"first_name": "emp first",
"last_name": "emp last"
,
"highlight": [
"first_name" : ["<em>emp</em> first"],
"last_name" : ["<em>emp</em> last"]
]
]
There is a feature in elasticsearch "Named Queries", you can named each query and elasticsearch will return the matched queries names
For your case you can use this query
GET index/doc_type/_search
"_source": [
"first_name",
"last_name"
],
"query":
"bool":
"should": [
"match":
"first_name":
"query": "emp",
"_name": "first_name"
,
"match":
"last_name":
"query": "emp",
"_name": "last_name"
]
Elasticsearch will return result like this one
"took": 90,
"timed_out": false,
"_shards":
"total": 5,
"successful": 5,
"failed": 0
,
"hits":
"total": 1,
"max_score": 16.399673,
"hits": [
"_index": "index",
"_type": "doc_type",
"_id": "1",
"_score": 16.399673,
"_routing": "1",
"_source":
"first_name": "emp first",
"last_name": "emp last"
,
"matched_queries": [
"first_name",
"last_name"
]
]
You can also do the same thing with highlighting
GET index/doc_type/_search
"_source": [
"first_name",
"last_name"
],
"query":
"bool":
"should": [
"match":
"first_name": "emp"
,
"match":
"last_name": "emp"
]
,
"highlight":
"fields":
"first_name": ,
"last_name" :
Sample Response :
"took": 90,
"timed_out": false,
"_shards":
"total": 5,
"successful": 5,
"failed": 0
,
"hits":
"total": 1,
"max_score": 16.399673,
"hits": [
"_index": "index",
"_type": "doc_type",
"_id": "1",
"_score": 16.399673,
"_routing": "1",
"_source":
"first_name": "emp first",
"last_name": "emp last"
,
"highlight": [
"first_name" : ["<em>emp</em> first"],
"last_name" : ["<em>emp</em> last"]
]
]
edited Mar 29 at 9:04
answered Mar 27 at 9:25
Ashraful IslamAshraful Islam
9,2152 gold badges22 silver badges37 bronze badges
9,2152 gold badges22 silver badges37 bronze badges
Thanks I'll read and verify the same. Also there is other feature 'highlighting' , this also might do a similar job, I have to find out yet.
– aditya ece
Mar 29 at 8:44
@adityaece Yes. You can also do it with the highlighting
– Ashraful Islam
Mar 29 at 8:58
add a comment |
Thanks I'll read and verify the same. Also there is other feature 'highlighting' , this also might do a similar job, I have to find out yet.
– aditya ece
Mar 29 at 8:44
@adityaece Yes. You can also do it with the highlighting
– Ashraful Islam
Mar 29 at 8:58
Thanks I'll read and verify the same. Also there is other feature 'highlighting' , this also might do a similar job, I have to find out yet.
– aditya ece
Mar 29 at 8:44
Thanks I'll read and verify the same. Also there is other feature 'highlighting' , this also might do a similar job, I have to find out yet.
– aditya ece
Mar 29 at 8:44
@adityaece Yes. You can also do it with the highlighting
– Ashraful Islam
Mar 29 at 8:58
@adityaece Yes. You can also do it with the highlighting
– Ashraful Islam
Mar 29 at 8:58
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55373265%2felastic-search-how-to-extract-all-fieldnames-that-match-the-query-phrase-stri%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown