# \[SOLVED\] Problem to create and test index manually

**URL:** <https://discuss.elastic.co/t/solved-problem-to-create-and-test-index-manually/49079>\
**Category:** Elasticsearch\
**Created:** [May 3, 2016, 4:19pm UTC](https://discuss.elastic.co/t/solved-problem-to-create-and-test-index-manually/49079 "2016-05-03T16:19:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![axelfelix](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@axelfelix](https://discuss.elastic.co/u/axelfelix)\
**Post date:** [May 3, 2016, 4:19pm UTC](https://discuss.elastic.co/t/solved-problem-to-create-and-test-index-manually/49079/1 "2016-05-03T16:19:38Z")

</div>

Hi all,

I try to make some tests but unsuccessful.

I try to create an test index:

> curl -XPUT localhost:9200/test -d@index\_template\_test.txt

index-template-test.txt file:

> ```
> {
> "settings" : {
> "analysis": {
> "tokenizer": {
> "custom-pattern-tokenizer": {
> "type": "pattern",
> "pattern": "."
> }
> },
> "analyzer": {
> "custom-analyzer": {
> "type": "custom",
> "tokenizer": "custom-pattern-tokenizer"
> }
> }
> }
>  
> },
> "mappings": {
> "my_type": {
> "properties": {
> "source_host": {
> "type": "string",
> "index": "analyzed",
> "analyzer": "custom-analyzer"
> }
> }
> }
> }
> }
> 
> ```

After, I put data:

> ```
> curl -XPUT localhost:9200/test/my_type/1 -d'
> {
> "source_host" : "mytest-test-1.fr"
> }'
> 
> ```

When I made a global search, I get an answer:

> ```
> curl -XGET localhost:9200/test/_search?pretty
> {
> "took" : 3,
> "timed_out" : false,
> "_shards" : {
> "total" : 5,
> "successful" : 5,
> "failed" : 0
> },
> "hits" : {
> "total" : 1,
> "max_score" : 1.0,
> "hits" : [ {
> "_index" : "test",
> "_type" : "my_type",
> "_id" : "1",
> "_score" : 1.0,
> "_source" : {
> "source_host" : "mytest-test-1.fr"
> }
> } ]
> }
> }
> 
> ```

But when I make a specific search, it returns nothing:

> ```
> curl -XGET localhost:9200/test/my_type/_search?pretty=true -d'
> {
> "query": { 
> "match": {
> "source_host" : "mytest-test-1.fr"
> }
> }
> }'
> {
> "took" : 1,
> "timed_out" : false,
> "_shards" : {
> "total" : 5,
> "successful" : 5,
> "failed" : 0
> },
> "hits" : {
> "total" : 0,
> "max_score" : null,
> "hits" : []
> }
> }
> 
> ```

So I can't make some test with \_analyze right now. Do you have any idea why I can't return a result with this kind of search ?

Result when I try an \_analyze:

> ```
> curl -XGET 'localhost:9200/test/_analyze?pretty&analyzer=custom-analyzer' -d mytest-test-1.fr
> {
> "tokens" : []
> }
> 
> ```

Thanks in advance,  
Alex

---

<div class="post-metadata">

**Author:** ![axelfelix](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@axelfelix](https://discuss.elastic.co/u/axelfelix)\
**Post date:** [May 4, 2016, 6:42am UTC](https://discuss.elastic.co/t/solved-problem-to-create-and-test-index-manually/49079/3 "2016-05-04T06:42:40Z")

</div>

After some tests, I don't understand really...

I created an index, and I put data:

> ```
> curl -XPUT localhost:9200/test/my_type/1 -d'
> {
> "source_host": "mytest-test-1.fr"
> }'
> {"_index":"test","_type":"my_type","_id":"1","_version":1,"_shards":{"total":2,"successful":2,"failed":0},"created":true}
> 
> ```

When I retry to make a specific search like below, I get nothing:

> ```
> curl -XGET localhost:9200/test/my_type/_search?pretty -d'
> {
> "query": {
> "term": { "source_host": "mytest-test-1.fr"}
> }
> }'
> {
> "took" : 1,
> "timed_out" : false,
> "_shards" : {
> "total" : 5,
> "successful" : 5,
> "failed" : 0
> },
> "hits" : {
> "total" : 0,
> "max_score" : null,
> "hits" : []
> }
> }
> 
> ```

But with this request, I get result:

> ```
> curl -XGET localhost:9200/test/my_type/_search?pretty&q=source_host:mytest-test-1.fr
> {
> "took" : 4,
> "timed_out" : false,
> "_shards" : {
> "total" : 5,
> "successful" : 5,
> "failed" : 0
> },
> "hits" : {
> "total" : 1,
> "max_score" : 1.0,
> "hits" : [ {
> "_index" : "test",
> "_type" : "my_type",
> "_id" : "1",
> "_score" : 1.0,
> "_source" : {
> "source_host" : "mytest-test-1.fr"
> }
> } ]
> }
> }
> 
> ```

Somebody can explain me why ? I become crazy about that !

Thanks in advance,  
Alex

---

<div class="post-metadata">

**Author:** ![axelfelix](https://avatars.discourse-cdn.com/v4/letter/a/5fc32e/32.png) [@axelfelix](https://discuss.elastic.co/u/axelfelix)\
**Post date:** [May 4, 2016, 8:09am UTC](https://discuss.elastic.co/t/solved-problem-to-create-and-test-index-manually/49079/4 "2016-05-04T08:09:38Z")

</div>

I found the problem. It was an indexing problem. My custom analyzer doesn't work so my indexation too.

Have a good day.

---

<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 5, 2017, 10:54pm UTC](https://discuss.elastic.co/t/solved-problem-to-create-and-test-index-manually/49079/5 "2017-07-05T22:54:07Z")

</div>


