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;








-1















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










share|improve this question






























    -1















    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










    share|improve this question


























      -1












      -1








      -1








      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










      share|improve this question














      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# elasticsearch lucene nest






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 27 at 9:01









      aditya eceaditya ece

      12 bronze badges




      12 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          1














          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"]
          ]

          ]







          share|improve this answer



























          • 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










          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
          );



          );













          draft saved

          draft discarded


















          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









          1














          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"]
          ]

          ]







          share|improve this answer



























          • 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















          1














          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"]
          ]

          ]







          share|improve this answer



























          • 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













          1












          1








          1







          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"]
          ]

          ]







          share|improve this answer















          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"]
          ]

          ]








          share|improve this answer














          share|improve this answer



          share|improve this answer








          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

















          • 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








          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.



















          draft saved

          draft discarded
















































          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

          155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해