# Searching and indexing of C# C++ .net asp.net doesn't work

**URL:** <https://discuss.elastic.co/t/searching-and-indexing-of-c-c-net-asp-net-doesnt-work/4070>\
**Category:** Elasticsearch\
**Created:** [March 9, 2011, 9:54pm UTC](https://discuss.elastic.co/t/searching-and-indexing-of-c-c-net-asp-net-doesnt-work/4070 "2011-03-09T21:54:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Richardy](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@Richardy](https://discuss.elastic.co/u/Richardy)\
**Post date:** [March 9, 2011, 9:54pm UTC](https://discuss.elastic.co/t/searching-and-indexing-of-c-c-net-asp-net-doesnt-work/4070/1 "2011-03-09T21:54:46Z")

</div>

curl -XPOST "localhost:9200/scratch" -d "{"""mappings""":{"""test""":  
{"""properties""":{"""jobtitle""":  
{"""type""":"""string"""},"""location""":  
{"""type""":"""geo\_point"""}}}}}"

curl -XPUT "[http://localhost:9200/scratch/test/1](http://localhost:9200/scratch/test/1)" -d  
"{"""jobtitle""":"""C# developer""","""location""":{"""lat""":  
40.12,"""lon""":-71.34}}"  
curl -XPUT "[http://localhost:9200/scratch/test/2](http://localhost:9200/scratch/test/2)" -d  
"{"""jobtitle""":"""C++ developer""","""location""":{"""lat""":  
40.12,"""lon""":-71.34}}"  
curl -XPUT "[http://localhost:9200/scratch/test/3](http://localhost:9200/scratch/test/3)" -d  
"{"""jobtitle""":"""[VB.Net](http://VB.Net) developer""","""location""":{"""lat""":  
40.12,"""lon""":-71.34}}"  
curl -XPUT "[http://localhost:9200/scratch/test/4](http://localhost:9200/scratch/test/4)" -d  
"{"""jobtitle""":""".Net developer""","""location""":{"""lat""":  
40.12,"""lon""":-71.34}}"

curl -XGET "[http://localhost:9200/scratch/test/\_search?pretty=true](http://localhost:9200/scratch/test/_search?pretty=true)" -d  
"{"""query""":{"""match\_all""":{}}}"

// Returns record but executing equiv for .net c# and C++ does not  
\gnu\bin\curl\curl -XGET "[http://localhost:9200/scratch/test/\_search](http://localhost:9200/scratch/test/_search)?  
pretty=true" -d "{"""query""":{"""term""":  
{"""jobtitle""":"""[vb.net](http://vb.net)"""}}}"

How can I get this to work?

One option is to search and replace before indexing but I am hoping  
there is a better option.  
C++ to CPlusPlus  
C# to CSharp  
.net to dotnet  
[vb.net](http://vb.net) to vbdotnet  
[asp.net](http://asp.net) to aspdotnet

---

<div class="post-metadata">

**Author:** ![IvanBrusic](https://avatars.discourse-cdn.com/v4/letter/i/ecae2f/32.png) [@IvanBrusic](https://discuss.elastic.co/u/IvanBrusic)\
**Post date:** [March 9, 2011, 10:51pm UTC](https://discuss.elastic.co/t/searching-and-indexing-of-c-c-net-asp-net-doesnt-work/4070/2 "2011-03-09T22:51:56Z")

</div>

String properties are analyzed by default. Term queries are not  
analyzed, so you are searching on a analyzed field with a non-analyzed  
term. You can either set the mapping to non\_analyzed or use a field  
query/query string.

Ivan

On Mar 9, 4:54 pm, Richardy [richard....@gmail.com](mailto:richard....@gmail.com) wrote:

> curl -XPOST "localhost:9200/scratch" -d "{"""mappings""":{"""test""":  
> {"""properties""":{"""jobtitle""":  
> {"""type""":"""string"""},"""location""":  
> {"""type""":"""geo\_point"""}}}}}"
> 
> curl -XPUT "[http://localhost:9200/scratch/test/1](http://localhost:9200/scratch/test/1)" -d  
> "{"""jobtitle""":"""C# developer""","""location""":{"""lat""":  
> 40.12,"""lon""":-71.34}}"  
> curl -XPUT "[http://localhost:9200/scratch/test/2](http://localhost:9200/scratch/test/2)" -d  
> "{"""jobtitle""":"""C++ developer""","""location""":{"""lat""":  
> 40.12,"""lon""":-71.34}}"  
> curl -XPUT "[http://localhost:9200/scratch/test/3](http://localhost:9200/scratch/test/3)" -d  
> "{"""jobtitle""":"""[VB.Net](http://VB.Net) developer""","""location""":{"""lat""":  
> 40.12,"""lon""":-71.34}}"  
> curl -XPUT "[http://localhost:9200/scratch/test/4](http://localhost:9200/scratch/test/4)" -d  
> "{"""jobtitle""":""".Net developer""","""location""":{"""lat""":  
> 40.12,"""lon""":-71.34}}"
> 
> curl -XGET "[http://localhost:9200/scratch/test/\_search?pretty=true](http://localhost:9200/scratch/test/_search?pretty=true)" -d  
> "{"""query""":{"""match\_all""":{}}}"
> 
> // Returns record but executing equiv for .net c# and C++ does not  
> \gnu\bin\curl\curl -XGET "[http://localhost:9200/scratch/test/\_search](http://localhost:9200/scratch/test/_search)?  
> pretty=true" -d "{"""query""":{"""term""":  
> {"""jobtitle""":"""[vb.net](http://vb.net)"""}}}"
> 
> How can I get this to work?
> 
> One option is to search and replace before indexing but I am hoping  
> there is a better option.  
> C++ to CPlusPlus  
> C# to CSharp  
> .net to dotnet  
> [vb.net](http://vb.net) to vbdotnet  
> [asp.net](http://asp.net) to aspdotnet

---

<div class="post-metadata">

**Author:** ![Richardy](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@Richardy](https://discuss.elastic.co/u/Richardy)\
**Post date:** [March 9, 2011, 11:28pm UTC](https://discuss.elastic.co/t/searching-and-indexing-of-c-c-net-asp-net-doesnt-work/4070/3 "2011-03-09T23:28:12Z")

</div>

Ivan

Thanks for replying so quickly.

I dropped index and recreated using this.

curl -XPOST "localhost:9200/scratch" -d "{"""mappings""":{"""test""":  
{"""properties""":{"""jobtitle""":  
{"""type""":"""string""","""index""":"""not\_analyzed"""},"""location""":  
{"""type""":"""geo\_point"""}}}}}"

I checked mapping took. It is not\_analyzed not non\_analyzed according  
to Elasticsearch documentation here [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/mapping/core-types.html)

{  
"scratch" : {  
"test" : {  
"properties" : {  
"jobtitle" : {  
"index" : "not\_analyzed",  
"type" : "string"  
},  
"location" : {  
"type" : "geo\_point"  
}  
}  
}  
}  
}

but my searches above still do not work. Interestingly the [vb.net](http://vb.net) one  
above no longer works either.

Converting to the following isn't desirable as I want to do keyword  
highlighting.  
C++ to CPlusPlus  
C# to CSharp  
.net to dotnet  
[vb.net](http://vb.net) to vbdotnet  
[asp.net](http://asp.net) to aspdotnet

Any further thoughts for a novice would be appreciated.

Rich

On Mar 9, 10:51 pm, Ivan Brusic [ivan\_bru...@yahoo.com](mailto:ivan_bru...@yahoo.com) wrote:

> String properties are analyzed by default. Term queries are not  
> analyzed, so you are searching on a analyzed field with a non-analyzed  
> term. You can either set the mapping to non\_analyzed or use a field  
> query/query string.
> 
> Ivan
> 
> On Mar 9, 4:54 pm, Richardy [richard....@gmail.com](mailto:richard....@gmail.com) wrote:
> 
> > curl -XPOST "localhost:9200/scratch" -d "{"""mappings""":{"""test""":  
> > {"""properties""":{"""jobtitle""":  
> > {"""type""":"""string"""},"""location""":  
> > {"""type""":"""geo\_point"""}}}}}"
> 
> > curl -XPUT "[http://localhost:9200/scratch/test/1](http://localhost:9200/scratch/test/1)" -d  
> > "{"""jobtitle""":"""C# developer""","""location""":{"""lat""":  
> > 40.12,"""lon""":-71.34}}"  
> > curl -XPUT "[http://localhost:9200/scratch/test/2](http://localhost:9200/scratch/test/2)" -d  
> > "{"""jobtitle""":"""C++ developer""","""location""":{"""lat""":  
> > 40.12,"""lon""":-71.34}}"  
> > curl -XPUT "[http://localhost:9200/scratch/test/3](http://localhost:9200/scratch/test/3)" -d  
> > "{"""jobtitle""":"""[VB.Net](http://VB.Net) developer""","""location""":{"""lat""":  
> > 40.12,"""lon""":-71.34}}"  
> > curl -XPUT "[http://localhost:9200/scratch/test/4](http://localhost:9200/scratch/test/4)" -d  
> > "{"""jobtitle""":""".Net developer""","""location""":{"""lat""":  
> > 40.12,"""lon""":-71.34}}"
> 
> > curl -XGET "[http://localhost:9200/scratch/test/\_search?pretty=true](http://localhost:9200/scratch/test/_search?pretty=true)" -d  
> > "{"""query""":{"""match\_all""":{}}}"
> 
> > // Returns record but executing equiv for .net c# and C++ does not  
> > \gnu\bin\curl\curl -XGET "[http://localhost:9200/scratch/test/\_search](http://localhost:9200/scratch/test/_search)?  
> > pretty=true" -d "{"""query""":{"""term""":  
> > {"""jobtitle""":"""[vb.net](http://vb.net)"""}}}"
> 
> > How can I get this to work?
> 
> > One option is to search and replace before indexing but I am hoping  
> > there is a better option.  
> > C++ to CPlusPlus  
> > C# to CSharp  
> > .net to dotnet  
> > [vb.net](http://vb.net) to vbdotnet  
> > [asp.net](http://asp.net) to aspdotnet

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:10am UTC](https://discuss.elastic.co/t/searching-and-indexing-of-c-c-net-asp-net-doesnt-work/4070/4 "2017-07-06T04:10:23Z")

</div>


